How can I reset my WordPress login password in my Lightsail instance?

Last updated: 2021-10-20

I want to change or reset the login password of my WordPress website in an Amazon Lightsail instance. How do I do that?

Resolution

Note: The file paths used in the resolution steps might change depending on the following:

  • The Bitnami stack uses native Linux system packages (Approach A).
  • The Bitnami stack is a self-contained installation (Approach B).

To identify your Bitnami installation type, run the following command:

test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

Run the following command in your instance to retrieve the admin login credentials of Lightsail WordPress websites:

cat /home/bitnami/bitnami_credentials

The user name for the login is always user. To reset the password of this user, use the following resolution steps:

The Bitnami stack is under Approach A

1.    Run the following command to see the list of login users in the database. You must enter the MySQL root password. This password is located in the /home/bitnami/bitnami_application_password file.

mysql -u root -p bitnami_wordpress -e "SELECT * FROM wp_users;"

Note: The password isn't displayed as you enter it so that it won't be visible to other users. If you receive an Access Denied error when using the preceding command, then reset the password. For more information, see the following:

2.    Note the ID of the user you want to reset the password for. Then run the following command. In the following example command, replace NEWPASSWORD with your desired password and ADMIN-ID with the user ID obtained in step 1.

mysql -u root -p bitnami_wordpress -e "UPDATE wp_users SET user_pass=MD5('NEWPASSWORD') WHERE ID='ADMIN-ID';"

Note: The preceding command asks you for the MySQL password that you obtained from the /home/bitnami/bitnami_application_password file. The password isn't displayed as you enter it so that it won't be visible to other users.

The Bitnami stack is under Approach B

The Bitnami stack under Approach B provides the bnconfig script. You can use this script to reset the WordPress admin login password. Run the following command to use the script and reset the password. In the following example command, replace NEWPASSWORD with your desired password.

/opt/bitnami/apps/wordpress/bnconfig --userpassword "NEWPASSWORD"

Note: The bnconfig script can be used only to reset the password of the user "user". If you want to reset the password of any other users, follow the steps in The Bitnami stack is under Approach A section.


Did this article help?


Do you need billing or technical support?