1

How can I get my wordpress password from an SQL file?

I have had problems because a user did not leave their password and it is on a virtual server which does not have PHPmyadmin or another service, because it is not mine, I can not install anything else, so I only keep an SQL file.

I already tried to use a forgotten password, but the server that is not mine does not send the emails.

I understand that my password has an MD5 encryption and that it uses a unique hash to generate my password, so I was wondering if it is possible to generate a new password or recover the previous one, or at least insert a new user directly in the SQL file.

The data is something like this:

INSERT INTO `dexim_users` VALUES
(1, 'username', '$ P $ BWKzpIbbKWKYlyajHA4Bv50StpKs6K.', 'UserName', 'mail@mail.com', '', '2016-08-08 17:40:00', '', 0, 'UserName ');
  • 2
    Just curious here, are you the admin of that site or have another way to access the server or not? If so, there are multiple options and to me it seems you are 'fishing' here, all sounds a little vague. But I have to admit it is just my intuition here. – Charles Jun 28 '18 at 22:44
  • hahaha, although it's a good theory, actually, I'm the administrator, but did not create the page. server belongs to a client, but I have no experience using virtual servers, because in my work we only use shared servers. – Cragser Jun 29 '18 at 14:56
0

Since you are the admin of the site, I assume you have access to phpMyAdmin. If so, find the database (look for the name in the wp-config.php file), and use phpMyAdmin to access the wp-users table. If not, see below.

Find your admin user account in that table, and change the email address (I am assuming that the email address is not yours). Then you can use the 'lost password' thing to reset your password.

You could also edit that same user row in the table, and type in your new password in the appropriate field. Click on the 'MD5' button to properly encrypt the password.

Now you will be able to login as the admin of the site.

But, since you don't have access to phpMyAdmin (the above answer part was for anyone finding this old question), then you need to create a new admin user. Assuming that you have selected the proper database, these commands ought to do that (changing values as needed):

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, 
`user_status`)
 VALUES ('admin999', MD5('password999'), 'firstname lastname', 'email@example.com', '0');

 INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) 
 VALUES (NULL, (Select max(id) FROM wp_users), 
 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

 INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) 
 VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

I got this from here: https://www.hostpapa.com/knowledgebase/create-admin-account-wordpress-via-mysql/ . There are plenty of other similar articles to be found with the googles.

Of course, backing up your database before you start is always a good idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.