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', 'youremail@yourdomain.com', 'https://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 | youremail@yourdomain.com | https://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!

 

0 Shares:
You May Also Like

iriver’s UNIT2 detailed on teaser site

One of the sexist and functional MP3 devices I've seen yet. The iPod had its time, and even the smallest iPod is really sexy. But this is just over the top.
iriver's UNIT2 detailed on teaser site -

Filed under: , ,


Mmm, there's nothing like fragmented high-resolution photos of a lust-worthy device to get us salivating, and iriver's marketing department has done an exquisite job figuring that out. Shortly after unveiling the sexiest e-dictionary known to man, the much anticipated UNIT2 conglomerate received its own teaser site, complete with photos and a few extra details you should know. While it has yet to lose its mystique, we now know (officially, at least) that the base will act as a DVD player, TV tuner, access point, charging station, hard drive, and a speaker station. Aside from sporting an SD slot and USB connectivity, this beauty will handle music, movies, photos, eBooks, and WiFi streaming without breaking a sweat. Mechanically, you can expect an automatic sliding door, detachable display, slot-loaded CD / DVD deck, and a 78-key controller to manage the fun. No word yet on the price, but be sure to peek the additional photos below.

 

Read | Permalink | Email this | Comments


Office Depot Featured Gadget: Xbox 360 Platinum System Packs the power to bring games to life!

[EnGadget]