Magento Open Source 2.2.x
Using a Database

By default, all images, compiled CSSCascading Style Sheets: A style sheet language that controls the appearance of HTML documents; a way to control the appearance of text, graphics, lists, links, and all other elements on a web page. files, and compiled JavaScriptA scripting language used with HTML to produce dynamic effects and interactions on web pages. files of the Magento instance are stored in the file system on the web server. You can choose to store these files in a database on a database server. One advantage of this approach is the option of automatic synchronization and reverse synchronization between the web server file system and the database. You can use the default database to store media or create a new one. To be able to use a newly created database as media storageA dedicated space on the content delivery network for your store's assets., you must add information about it and its access credentials to the local.xml file.

To use a database for media storage:

1. On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.
2. In the panel on the left, under Advanced, choose System.
3. In the upper-left corner set Store View to “Default Config,” to apply the configuration at the global level.
4. Expand the Storage Configuration for Media section. Then, do the following:
a. Set Media Storage to “Database.”
b. Set Select Media Database to the database you want to use.
c. Tap Synchronize to transfer the existing media to the newly selected database.
d. Enter the Environment Update Time in seconds.
5. When complete, tap Save Config.