What is the WordPress database? All you need to know

The WordPress database is where all the website data is stored. Not just basic information like usernames and passwords, but also posts, pages, and comments, even the website theme and WordPress settings. Today we will discuss why and how you should manage your WordPress database. Buckle up and enjoy the ride.

Why does WordPress need a database?

Let’s first see what a database is. As mentioned above, a database can be an invaluable solution for storing and accessing valuable data.

A database is a structured set of organized data. In the IT field, database management systems (DBMS) refer to software that interacts with a user and data, as well as accesses and stores data. It’s pretty much the same when you save images or videos to your computer’s drive, or the folder where you keep your business cards if you prefer old-school card management. Having a personal database to access that data is very helpful.

There are several ways to use and access the database. WordPress uses as a database management system. MySQL is open source software, and it is responsible for managing the components of a WordPress database, such as user data, user metadata, posts, comments, etc. We will see it in detail a little later.

WordPress uses PHP, using within the PHP markup, as the instruction language for Create, Read, Update and Delete data from the MySQL database. The database is an essential part of WordPress; it is the backbone that stores all the information of the nucleus. The database also ensures that your page runs smoothly, is fully optimized, and helps you back up your data regularly.

The next question, where is the database stored?

What is database host?

Your WordPress database is hosted by a database host, which then hosts it on the MySQL server. The database host is like a house that you can go to with a specific address (hostname). You can extract something from the room section (database name). Of course, you will need permission to do so, which is why you need to enter the username and password before entering the house.

See also  How to fix ERR_SSL_VERSION_OR_CIPHER_MISMATCH?

For the most part, you can use localhost to manage and connect WordPress to your database. However, you can also manage the MySQL server if your web host uses a different hostname. In , for example, you can access the MySQL database in the section Databases from the control panel.

What is database table?

In the database, these are stored in the form of tables. Each table consists of unique data and is displayed in rows. And the rows also contain other pieces of information or parameters. By default, WordPress will automatically create those tables when you first set up the website. WordPress version 4.4 will create the following main tables in the database:

  1. wp comment meta: Each comment has unique information called metadata, that data will be available in this section.
  2. wp comments: All comments in WordPress will be available in this table.
  3. wp links: This section contains information related to links entered into the WordPress Links feature.
  4. wp options: This section contains data that WordPress uses to store various preferences and settings.
  5. wp postmeta: Each post has unique information called metadata, that data will be available in this section.
  6. wp posts: In WordPress, “posts” are articles that you write for your blog. This section will store that data. Pages and navigation menu items are also stored here.
  7. wp termmeta: Each term has unique information called metadata, that data will be available in this section.
  8. wp terms: Here the categories of both posts and links, as well as the labels of the posts, are stored.
  9. wp term relationships: The posts are associated with categories and labels of the table wp_termsand this association is maintained here.
  10. wp term taxonomy: This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
  11. wp usermeta: each user has unique information called metadata, that data will be available in this section.
  12. wp users: The list of users is maintained here.
See also  The surprising story of the first website

By default, you can’t delete WordPress parent tables, but this benefits your content. To explore more about tables, we suggest you read .

What is an SQL query?

SQL is short for Structured Query Language; is a programming language used to manage databases. An SQL request issued to Create, Read, Update, and Delete (this is known as CRUD: Create, Read, Update, and Delete) on the database server is called a query. WordPress uses MySQL queries to store and extract the data to generate the web pages.

A query can be useful, especially if you want to optimize your website. For example, to eliminate spam comments that are cluttering your database and slowing down your website. A query can quickly remove them, run the following command to do so:

DELETE FROM wp_comments WHERE wp_comments.comment_approved = ‘spam’;

You can also make a query if you want to delete an unwanted post, specifically the oldest ones. To do this, run the following query:

DELETE * FROM `wp_posts`
WHERE `post_type` = ‘post’
AND DATEDIFF(NOW(), `post_date`) > 30

You can change the number “30” to any publication date you wish to remove. In this example, posts older than 30 days will be deleted.

You can always manually delete spam and older posts from the WordPress frontend, but the query puts the power literally in your hands.

Pro Tip: Remember to make a backup before executing any changes to your database!

How to manage the WordPress database?

So far we have covered a lot of information about database management. Now, let’s put it into practice.

Manage your WordPress database, or rather MySQL server, with phpMyAdmin. It is an open source web application with a user-friendly user interface. provides you with phpMyAdmin in the control panel. You can access it in the section of Databases:

See also  How to Include Icons in WordPress: A Beginner's Guide

Or better yet, we’ve created a unique direct link for you to access phpMyAdmin. Just remember to write down the username and password of your MySQL server. You can find it here:

After clicking the direct link or button phpMyAdminyou will be directed to the phpMyAdmin interface:

As you can see, that is the core database created by WordPress. I haven’t made any significant changes to my web page, so no additional tables have been created. However, you should remember that every time you make changes to WordPress, those tables can get bigger. That is why you must handle them well.

Let’s do some basic management when creating a backup. Click on the tab Export and choose the appropriate option.

That instruction will download the SQL files to your computer.

conclusion

Databases and WordPress are like two sides of the same coin; They work shoulder to shoulder to ensure that your website performs as well as possible and that all your data is well managed.

In summary, we have covered the benefits of having a database to store and extract data. We have also learned how to use query to make our database administration work easier and finally we know how to do basic WordPress database administration with phpMyAdmin.

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...