How to view the Admin account in the WordPress database using MySQL and a database dump.

How to view the Admin account in the WordPress database using MySQL.

mysql> select * from wp_users where user_login = "Admin";
+----+------------+------------------------------------+---------------+------------------------+------------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass                          | user_nicename | user_email             | user_url                     | user_registered     | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+------------------------+------------------------------+---------------------+---------------------+-------------+--------------+
|  1 | Admin      | $P$Bt0QTjses0mAaASZtqYbcnz8zalQK71 | admin         | info@bejiitaswrath.com | http://www.bejiitaswrath.com | 2010-10-16 14:30:20 |                     |           0 | Admin        |
+----+------------+------------------------------------+---------------+------------------------+------------------------------+---------------------+---------------------+-------------+--------------+
1 row in set (0.00 sec)

This is an old database that I imported into MySQl on my Linux Mint box, so if you want to try and crack the hash you are welcome. Below I am showing how to list a few of the post tags that were present in this database dump.

mysql> select * from wp_terms limit 10;
+---------+---------------+---------------+------------+
| term_id | name          | slug          | term_group |
+---------+---------------+---------------+------------+
|       1 | Uncategorized | uncategorized |          0 |
|       2 | Blogroll      | blogroll      |          0 |
|       3 | Doom          | doom          |          0 |
|       4 | Winshite      | winshite      |          0 |
|       5 | Return.       | return        |          0 |
|       6 | Look.         | look          |          0 |
|       7 | Ubuntuu       | ubuntuu       |          0 |
|       8 | Guestbook     | guestbook     |          0 |
|       9 | Vaccine       | vaccine       |          0 |
|      10 | Poison        | poison        |          0 |
+---------+---------------+---------------+------------+
10 rows in set (0.00 sec)

To import a mysql dump of your WordPress website into MySQl, firstly you need to create the database.

In my case it was named my_blog.

mysql> create database my_blog;

Then import the database dump.

john@adeptus-mechanicus ~/Documents $ mysql -uroot -p my_blog < my_blog.sql

Then start MySQL and switch to the database we are working on.

john@adeptus-mechanicus ~/Documents $ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)
 
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> use my_blog;

And you then may view the contents of your blog`s database.

mysql> show tables;
+--------------------------------+
| Tables_in_my_blog |
+--------------------------------+
| wp_commentmeta |
| wp_comments |
| wp_links |
| wp_makroncommentmeta |
| wp_makroncomments |
| wp_makronlinks |
| wp_makronoptions |
| wp_makronpopularpostsdata |
| wp_makronpopularpostsdatacache |
| wp_makronpostmeta |
| wp_makronposts |
| wp_makronterm_relationships |
| wp_makronterm_taxonomy |
| wp_makronterms |
| wp_makronusermeta |
| wp_makronusers |
| wp_options |
| wp_popularpostsdata |
| wp_popularpostsdatacache |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_terms |
| wp_usermeta |
| wp_users |
+--------------------------------+
26 rows in set (0.00 sec)

If you need to change the password for the WordPress user; this SQL will work. But you would not use this password!

mysql> UPDATE wp_users SET user_pass = MD5('password') WHERE ID = 1;

And this SQL will change the site URL.

mysql> UPDATE wp_options SET option_value = 'http://localhost' WHERE option_id =1;

If you have access to your blog database using MySQL or PHPMyAdmin, then you may use these samples of SQL to reset your password and perform other tasks to repair the WordPress database.

No comments have been made. Use this form to start the conversation :)

Leave a Reply