Reputation: 354
I’ve used wp all in one plugin to migrate my site to aws lightsail. However, it also migrated the old credentials which was owned by the previous webhosting company. I’m not able to obtain those credentials. In this case, how can I reset my user and password to my new Wordpress? My lightsail ssh has a bitanami interface on the console, I suppose that is how I should go about it but I'm exactly sure about the steps.
Upvotes: 3
Views: 3468
Reputation: 1
I tried these codes in Lightsail, but it didn't work, so I found a way.
mysql -u root -p bitnami_wordpress -e "..."
mysql -u root -p bitnami_wordpress -e
"INSERT INTO wp_usermeta(
umeta_id, user_id, meta_key, meta_value
) VALUES (
NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s: 1:"1";}'
);"
Upvotes: 0
Reputation: 190
You should use wp cli for resetting password.
wp user list --role=administrator
to get administrator user idwp user update 1 --user_pass=newpass
to reset password.Upvotes: 3
Reputation: 63
if you have ssh access you can change the password by following MySQL query
UPDATE wp_users SET user_pass = MD5('your-new-password') WHERE ID = 'any-admin-ID'
Or if you don't know any administrator account you can create one By
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 ('4', 'new-username', MD5('your-new-password'), 'Your Name', '[email protected]', 'http://www.test.com/', '2021-06-17 00:00:00', '', '0', 'Your Name');
and assign it as administrator by following queries
INSERT INTO wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '4', 'wp_user_level', '10');
*Replace wp_
with your DB prefix
Upvotes: 0