Kinetic Pulse
  • Home
  • Services
  • Portfolio
  • Blog
  • Terms
  • Contact

Help – I’m locked out of WordPress! Adding users to the WP database using MySQL

April 7, 2014

I’ve just had this query from a client – well more that he had a site that was out of date and was showing errors (from a host who had upgraded the version of php and the version of WP the client was running was showing up deprecated errors.) So I said I would sort it out for him – but the name & password that had worked before was simply not working for me.

Time for some drastic action.
I knew that all it takes to create a new user in the wp_users table in thr database (and I had full phpMyAdmin access)
so I found this excellent article on how to add admin users here:

http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/

Essentially it boils down to running these 3 lines of MySQL:

INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('999', 'newusername', MD5('newpassword'), 'Laura James', 'laura@yourdomain.com', '', '2014-06-07 00:00:00', '', '0', 'Laura James');

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

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '999', 'wp_user_level', '10');

Then you should be able to login with the following user name & password
newusername
newpassword

Note: It does show how it is so important to lock down direct access to your MySQL database when running WordPress as anyone who has this access can easily create new admin users for your WP install.

Share

Facebook Google+ Twitter Pinterest Email

Back to Blog

Testimonials

Thank you guys so much for all that you’ve done helping us to create a really awesome website!! We get such great feedback – everyone loves it & we couldn’t be prouder! Look forward to working with you again soon!
Wild Thyme PlantsWild Thyme Plants
I like it.  I like it a lot !!!

 You have interpreted what I wanted to achieve perfectly considering what you have to play with i.e not redoing the whole thing in the process.

Fiona Simmons-MooreSouth Gloucestershire Parents & Carers
Thanks so much for all your work on this, really appreciated. It’s come on in leaps and bounds since you took over.
Pete KewRedwood Strip Curtains
Amazing and brilliant, Kinetic Pulse have lifted a dream to reality, Highly recommended and great if you are total novice, they know their stuff…Thanks again
Annie LindridgeSalt Yourself Out
Absolutely fantastically professional web developer – I would highly recommend!!! Thank you so much Kinetic Pulse!
Tania MarstonDoris Designs
It’s been fab working with you – we love the site and certainly going to recommend you!
James DaviesThirty Eight Degrees North
Thank you for all of your hard work its looks fab and I am over the moon with it!
Amanda MercerAmanda Mercer Ceramics

Copyright 2025 Kinetic Pulse