I want to change or reset the login password of my WordPress website in an Amazon Lightsail instance.
You can change your WordPress admin password through one of two methods, depending on how your Bitnami stack is installed.
Note: The following resolution applies only to your WordPress admin password, and doesn't address OS or database password recovery. For information on how to change your database password, see Modify the database password on the Bitnami website.
The file paths that are used in the following steps depend on your Bitnami stack. Follow the resolution that's appropriate for your setup:
- The Bitnami stack uses native Linux system packages
- The Bitnami stack is a self-contained installation
For more information on Bitnami stack installation, see Understand upcoming changes to Bitnami Stacks on the Bitnami website.
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:
The user name for the login is always user. To reset the password of this user, follow the resolution steps that apply to your Bitnami stack.
The Bitnami stack uses native Linux system packages
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
mysql -u root -p bitnami_wordpress -e "SELECT * FROM wp_users;"
Note: The password isn't displayed as you enter it so that it isn't visible to other users. If you receive an Access Denied error when using the preceding command, then reset the password. For more information, see Modify the default MariaDB administrator password and Modify the MySQL administrator password on the Bitnami site.
2. Note the ID of the user that you want to reset the password for. Then, run the following command. Be sure to 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 isn't visible to other users.
The Bitnami stack is a self-contained installation
The Bitnami stack provides the bnconfig. This script resets the WordPress admin login password. Run the following command to use the script and reset the password. Be sure to replace NEWPASSWORD with your desired password:
/opt/bitnami/apps/wordpress/bnconfig --userpassword "NEWPASSWORD"
Note: The bnconfig script can only reset the password of the user that's named user. To reset the password of any other users, follow the steps in the previous section The Bitnami stack uses native Linux system packages.