Skip to main content
Version: 2.0.31

How to Change the OpenPanel Database Password

OpenPanel keeps its users, plans, domains and websites in a MariaDB database in the openpanel_mysql container, listening on 127.0.0.1:3306. The installer generates a random password for its root and panel users and stores it in /root/.env, /etc/my.cnf and /etc/openpanel/mysql/container_my.cnf.

Change it if the password may have been exposed (it was shared, pasted in a ticket, found in a log or a backup that left the server), when a server administrator leaves, or after migrating the server.

Change the password​

Run as root:

opencli db-password

This generates a new random password, sets it for the database users, updates all three files, recreates openpanel_mysql and restarts OpenPanel and OpenAdmin. It takes a few seconds. If anything fails, the previous password is restored.

To set a specific password instead of a random one:

opencli db-password --password=MyNew.Strong_Password123

See opencli db-password for all options.

After changing it​

  • Any external tool or script that connects to the panel database with the old password needs the new one, read it from /etc/my.cnf.
  • The password is only readable by root. Old update logs in /var/log/openpanel/updates/ from versions before 2.0.32 could contain it, updating to 2.0.32 masks it in those logs and makes them root-only.