Where do all posts, pages, comments, and data from your WordPress website saved to?
Every time when you create a new post, the content has to be stored somewhere. Well, unlike your computer, the content cannot be stored on the local hard drive.
It needs to be publicly accessible all the time so that whenever someone types your website URL, they can see your website displayed on their device.
If you think the content is stored in the server, then you're right, more specifically it is stored in a database. WordPress uses database software known as MySQL (some servers use MariaDB which is fine as well.).
A database is an organized collection of structured information or data, stored in a very organized manner so that the data can be easily and quickly accessed, modified, managed, updated. Think of it as a pigeonhole cabinet where each space stores different files and documents, properly labeled. So when you need to retrieve an office rental file, you can straightaway go to the Office Rental pigeonhole and pull out the file.
When WordPress is first installed, the database with all the required tables is automatically created. In the case of MySQL (or MariaDB, etc), the MySQL database is made up of tables that hold rows of data that are related to WordPress installation.
MySQL and Database Hierarchy
To understand how database saves data, we need to look at the MySQL database hierarchy which includes:
- Database – store all your WordPress content
- Table – Different table store different content, eg wp_comments keep tracks of all comments on your site. wp_users in-charge of site users, etc
- Record – each rows in the table is a record for eg a record may contain user ID, email, user status, etc
- Field – A field may made up of different data types (text, numeric, currecy, etc). For eg email is one of the field
To access and view your tables within your database, you can use phpMyAdmin. Most web hosting has this available within the database section. Upon clicking you will see multiple tables which are used to store different content on your website. here is a glimpse of how it looks like.
All the content that you see in the posts, pages, dashboard, and pretty much any section of your website mostly comes from the database. The database pulls the data out and displays it nicely on the webpage.
That's exactly how and where data or content are stored in WordPress. Do you need to care about this, unless you are a web developer/programmer or someone who works directly on the database, chances are you don't need it to, the info is only for your knowledge in case you are wondering the data are stored every time you published or a post or created a page.
Everything works in the background from the moment you create the WordPress to saving posts and retrieve posts, so you don't have to get your hands dirty 🙂 You just focus on building the website without worrying about what's going on in the background. More importantly, WordPress allows you to create any type of website without coding which makes your life easier.