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

2 minute read
0

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

Short description

Change your WordPress admin password based on how your Bitnami stack is installed.

Note: The following resolution applies only to your WordPress admin password and doesn't apply to operating system (OS) or database password recovery. For more information, see Modify the default MariaDB administrator password and Modify the MySQL administrator password on the Bitnami website.

Resolution

Identify your Bitnami installation type, and then follow the resolution that's appropriate for your setup.

To identify your 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."

To retrieve the admin login credentials of Lightsail WordPress websites, run the following command in your instance:

cat /home/bitnami/bitnami_credentials

The username for the login is always user. To reset the user password, follow the resolution steps that apply to your Bitnami stack.

Native Linux system packages

For a Bitnami stack that uses native Linux system packages, complete the following steps:

  1. Run the following command to see the list of login users in the database:
    mysql -u root -p bitnami_wordpress -e "SELECT * FROM wp_users;"
    Note: The preceding command requires the MySQL password that you got from the /home/bitnami/bitnami_application_password file. As you enter the password, the password is hidden for security reasons.
  2. Note the ID of the user that you want to reset the password for.
  3. Run the following command to reset the password:
    mysql -u root -p bitnami_wordpress -e "UPDATE wp_users SET user_pass=MD5('NEWPASSWORD') WHERE ID='ADMIN-ID';"
    Note: Replace NEWPASSWORD with your new password and ADMIN-ID with your user ID.

Self-contained installation

For Bitnami installations that are self-contained, the Bitnami stack provides the bnconfig script that resets the WordPress admin login password. To use the script and reset the password, run the following command:

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

Note: Replace NEWPASSWORD with your new password. The bnconfig script can reset only the password of the user that's named user.

AWS OFFICIAL
AWS OFFICIALUpdated a month ago