Reset the database password

NOTE: A multi-tier environment typically consists of multiple servers. The steps below should be performed on the database server (the server instance hosting the database), which includes a mysql client.

In order to reset the database password, you need to connect to the database server. By default, the database port in this solution cannot be accessed over a public IP address. Follow these instructions to learn how to connect to the database server pivoting in the application server.

If you don’t remember your MariaDB root password, once logged in the database server, you can follow the steps below to reset it to a new value:

  • Create a file in /home/bitnami/mysql-init with the content shown below (replace NEW_PASSWORD with the password you wish to use):

      UPDATE mysql.user SET Password=PASSWORD('NEW_PASSWORD') WHERE User='root';
  • Stop the services:

      $ sudo service bitnami stop
  • Start the MariaDB service with the following command:

      $ sudo /opt/bitnami/mariadb/bin/mysqld_safe --defaults-file=/opt/bitnami/mariadb/conf/my.cnf --pid-file=/opt/bitnami/mariadb/tmp/ --init-file=/home/bitnami/mysql-init 2> /dev/null &
  • Restart the services:

      $ sudo service bitnami start
  • Remove the init script:

      $ rm /home/bitnami/mysql-init

You should now be able to access the database server with the new password.

Last modification January 16, 2023