How to view the contents of your WordPress database

How to view the contents of your WordPress database

Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net _
Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net
My site is running WordPress, which store data in a mysql database. As part of my backup procedure, I backup the database as well as the WordPress files.
For fun I thought I’d inspect the actual contents of the database, and in case others wish to do the same here’s how to go about it.

First, let’s install MySQL:

…and make sure it’s started:

Now, if you haven’t already set the MySQL root user (not the same as the linux root user), let go do that:

Now we have a user with permission to create databases, so let’s create the database into which we’ll later import our WordPress database:

Note that in the command line above, there must be now spaces between the “-p” option and the password.

If you haven’t already done so, download the WordPress database. In my example, the database has been downloaded to /path/to/my/database/file.sql.
We’re now ready to do the actual database import:

After importing the database, we can access it and run queries:

Done!

Leave a Reply

%d bloggers like this: