How To Create A WordPress Admin Login Using MySQL

You can do this simply by running the following SQL commands through phpMyadmin or through command line MySQL.

1. First insert the new user account into the database.

If you’re using command line MySQL then you will need to select the database first using the “use” command below:

use wp_mywordpressdatabasename

Now that you’ve selected the database, you can run the following query to insert the new user account into the wp_users table of your WordPress Database. You will want to fill in your details below before executing the query. You enter this query under the “SQL” tab within phpMyAdmin.

INSERT INTO `wp_users` (`id`,`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('','john', MD5('newpassword123'), 'John Smith', '[email protected]', 'http://geektank.net/', '2013-29-03 00:00:00', '', '0', 'John Smith');

 

If successfully you should see:

Query OK, 1 row affected (0.00 sec)

Note, the field ‘ID’ is blank because this field is set to auto-increment within the table, a number will automatically to the ‘ID’ field for the new user.

2. Find out what ID your new account received.

Now that you have the successfully inserted the new record into the wp_users table. You want to know the new ID for the new account. You can find this rather easily with phpMyAdmin, but if you’re using the mysql command line simply run the following.

select * from wp_users where user_login = "john";

Which should return:

+----+------------+----------------------------------+---------------+--------------------------+-------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+----+------------+----------------------------------+---------------+--------------------------+-------------------------+--------+------------+---------------------+-------------+--------------+
| 5 | john | 8359b10e30dfabd587a5661e52249101 | John Smith | [email protected] | http://geektank.net | 2012-08-23 00:00:00 | | 0 | John Smith |
+----+------------+----------------------------------+---------------+--------------------------+----------+--------------+---------------------+---------------------+-------------+--------------+

The ID for the new account we created is 5.

3. Making the new WordPress Account an Administrator (wp_usermeta bits)

Even though we added a new user, it doesn’t have Administrator rights yet. We need to add a couple of entries to the wp_usermeta table. Taking the ID of the new user we create the following two queries.

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_user_level', '10');

These queries will tell provide Administrator rights to our new user account.

4. Enjoy the new account!

You’re done!

 


Did you like this article?


0 Shares:
You May Also Like

Corporate critics feel the stinging lash of DMCA misuse

I use to work for an ISP and was head of the Abuse Department. We only really received legitimate DCMA's that were then handled by legal. We didn't really seem to get that many DMCA notices, maybe its because we're a Canadian organization?
Corporate critics feel the stinging lash of DMCA misuse -

Two recent cases show that companies aren't always fans of criticism, and some will file misguided DMCA notices and defamation cases to scrub it from the Internet.

Read More...

Read More

Auto Bounced Messages Management vBulletin Module Helps Purge Bad Email Address On Your Forum

I was browsing through my mail spool on my machine, and I noticed that there were some messages in one of my accounts for a vBulletin forum. After further review, it was some bounce backs that had accumulated from users that didn't have a valid email address. I then started to do some Google searches for a vBulletin module (vBulletin's search is horrendous and practically useless) and found this module.
Read More

Linksys WRT54G and WRT54GL Being Phased Out?

I went to pick up a Wireless Router from a local computer shop http://www.a-power.com in hopes of grabbing a WRT54GL or at least a WRT54GS. The main reason being that I could flash the hardware to run DD-WRT http://www.dd-wrt.com which is a third part open source router firmware.
Read More