The 10 Most Common WordPress Database Questions Answered

Estimated Reading Time: 9 Minutes

By: Brian McCrackenbutton to visit the authors linked profile
High Level Developer

WordPress databases are a necessary part of any WordPress website. The database stores all of the data and information that the site needs to run and operate properly. This includes posts, pages, comments, user information, transactions, contact form submissions, and more depending on how the site is configured.

The posts and pages of a WordPress site aren’t like the old static HTML pages of yesteryear. The information on those posts and pages is stored in the database is used to dynamically generate the content on the website. This allows it to be easily updated and changed as required.

Not only does a database help you easily change or update content, but it allows it to be organized and sorted as well. With a WordPress database, you can easily search, sort, and filter the data allowing you to find what you need without much effort. In the case of larger WordPress databases, it allows multiple users to access and update the data simultaneously, which is very useful for large websites with multiple authors and contributors.

Databases are hardly the most entertaining thing to work with for most people. Particularly if you’re not a fulltime web developer.

If you find yourself having an issue, we are happy to help.

let's answer from WordPress questions with THE ROCK
Haters will say it’s fake, but this is an actual still picture taken of our database administrator on a business casual Friday last February when we were talking about writing an article about WordPress databases.

Does a Website Using WordPress Need a Database or Can it Work Without One?

Yes, WordPress sites need a database. WordPress is a dynamic PHP site that uses a database to store all of it’s content. This includes the content for pages, posts, categories, comments, transactions, contact forms entries, and more depending on how the WordPress site is configured.

Where Are WordPress Databases Stored?

Typically the server hosting your site will also be where the database for that site is kept.

In higher performance hosting environments like the type we provide for our clients, that database may be on a second remote database server that is responsible only for providing the WordPress site the information it needs. These configurations are commonly much faster as they allow two servers to do their individual jobs to their best of their ability (one for serving websites, and the other for providing those websites with their databases.)

Where Is There WordPress Database Connection String?

The connection information that a WordPress site needs to access it’s database is stored in the wp-config.php file in the root of the WordPress installation.

That connection information is one of the factors that makes wp-config.php such a high value target for hackers attempting to compromise a WordPress site.

In a hosting environment like we provide for our customers, the connection information is held on the host machine and not in the file. Doing this increases the security of a WordPress site as even if a hacker does gain access to that file, they can’t get any of the critical connection information they were hoping to find.

How To Connect My WordPress Website to a Database?

During the WordPress installation process, WordPress will ask you for your database connection information.

image of the wp installation screen where it asks for your database connection details
During a WordPress installation, it will ask you for your database connection details at this screen.

If you have a site that is already partially built and can’t get to that setup screen, you can enter the details in the wp-config.php file found in the root of your WordPress installation or ask your WordPress developer to reconnect the database for you.

How Big Can a WordPress Website’s Database Be?

Depending on the amount of content and data that is stored in a WordPress database, they can greatly vary in size. A smaller website that has just a few posts and some product or service pages may only be a few hundred megabytes. In the case of larger websites with a lot of content, or a high number of users, the database can very easily be several gigabytes or larger.

On average, a WordPress database is likely between 600mg and 1.5gb in size. In addition to the amount of content being stored for the website’s posts and pages, the type of information stored in the database can affect it’s size as well.

It’s important to keep in mind that large databases can negatively impact and WordPress websites performance. Large databases will take longer to query and retrieve information the website needs to render a page for a visitors. Because of that, it’s important to occasionally clean and optimize your website’s database to maintain efficient performance for years to come.

Are Databases Not The Most Exciting Thing For You?

Tell us what you’ve got going on. We’re happy to offer some advice or lend a hand fixing it.

    How Many Tables Does WordPress Use in MySQL?

    A default WordPress installation uses 11 tables to store a website’s data. These tables are:

    1. wp_posts: This table stores all of the posts, pages, and custom post types for the WordPress website.
    2. wp_comments: This tables stores all of the comments left by visitors on the website.
    3. wp_users: This table stores all of the users registered, or awaiting registration approval on the website.
    4. wp_usermeta: This table stores the metadata for users. This includes user roles and capabilities.
    5. wp_options: This table stores site-wide settings and options.
    6. wp_links: When a link is created with the WordPress Link Manager it is stored in this table.
    7. wp_terms: This table stores the terms and phrases that are used in taxonomies such as categories or tags.
    8. wp_term_taxonomy: This is where the taxonomy information for terms, such as the taxonomy type (e.g. category or tag) is stored.
    9. wp_term_relationships: This holds the relationships between posts and terms for the site.
    10. wp_commentmeta: Here you will find all of the metadata for comments, such as the IP address of the commenter.
    11. wp_termmeta: This important table stores metadata for terms, such as custom fields.

    While a default installation of WordPress only has 11 tables, more are often added by plugins and themes.

    How To Find a WordPress Admin URL From a Database?

    You will need to have access to the WordPress database to find this information. A common tool such as phpMyAdmin is often offered by most hosts to help you interact with your website’s database.

    1. Locate the wp_options table in your website’s database.
    2. Locate a row with the option_name “siteurl”. This will contain the URL of your site.
    3. Once you have the website’s URL, you can simply add “/wp-admin” to the end of the URL to get to the administration panel once logged in.

    In some cases, the admin URL may be customized or changed using the “admin_url” filter. If that’s been done, then you will need to locate where that filter is being used in the files of your WordPress site to determine where the new URL for the admin panel is located.

    WordPress admin dashboard

    Where Is the WordPress Database Password?

    You can find the password for your WordPress database in the wp-config.php file located in the root of your website’s installation.

    Once you’ve opened the wp-config.php file in a code or text editor, look for the following lines:

    define('DB_NAME', 'database_name');
    define('DB_USER', 'database_username');
    define('DB_PASSWORD', 'database_password');

    As you may have guessed, the value for “database_password” is the password for the database. It is important not to share this password and keep it secure as it is used to authenticate with your database and all of the important information stored in it for your website.

    An image displaying the DB connection details in the wp-config.php WordPress file.
    Your wp-config.php file will display the connection details for your database.

    If you do not have access to the wp-config.php file, you will have to contact your hosting provider for further assistance.

    How to Clean a WordPress Database?

    There are a few ways you can clean a WordPress database.

    1. If you just want to remove all of the existing content, you can use the “Tools” menu and the “Delete all posts” and “Delete all pages” options to remove the website’s posts and pages respectively.
    2. If you can use a plugin to clean your database as well. If you want to reset the database to it’s default states, you can use the “WP Reset” plugin. It also allows you to selectively delete only certain types of data if you like.
    3. If you have access to a database management tool such as phpMyAdmin, you can use that to manipulate and remove data from the database as well. Keep in mind, this is a complicated process and should only be done by an experienced developer.

    Any more thorough or detailed cleaning should only be done by a professional and experienced WordPress developer.

    How To Resolve “Cannot Connect” To Database in WordPress?

    When you see this error, there can be a number of reasons it is showing it’s ugly head. Here’s a few ways to resolve this problem.

    1. Locate the wp-config.php file in the root of your WordPress installation. Check to be sure that these details are correct or haven’t been recently changed. Your hosting provider may be able to help reset them if you are unsure.
    2. Make sure the database server itself is up. If you are managing your own hosting, this can be as easy to being sure the service is up and responding. Failing that, you can always restart it. (Yep, turn it off and back on again. Never fails.)
    3. Verify your hosting environment. If you are using shared hosting, you will want to contact your web host and see if they have currently experiencing an outage.
    4. If your connect issues starts just after installing a new plugin or theme, you may have a conflict occurring. using FTP you can manually deactivate the new plugin or theme to see if that resolves your issue.

    If none of these work, contact a professional WordPress developer or your hosting company to get additional assistance.

    fixing database issues at work
    Don’t do this. Send us an email. It’s far less expensive than a new laptop.

    Final Thoughts On The Top 10 WordPress Database Questions Answered

    It’s understandable if the GIF of The Rock at the top of this article didn’t convince you databases are fun to work with. That said, they are a part of every day life when working with WordPress sites, and sometimes they have issues.

    If you find yourself having issues with yours, reach out. Let’s make your problem our problem.

    Need Some Database Help?

    Let’s get you out of the situation you are in together.

      Need Help With Your
      Web Design?

      Hey, We're Cleveland Web Works.

      We are passionate about helping businesses overcome design challenges.

      Our only question is,
      will it be yours?

      Cleveland Web Works Team