Skip to main content
Version: 2.0.31

Database

opencli db-password changes the password of the OpenPanel database, the root and panel users in the openpanel_mysql container. It's the same password for both, as set up by the installer.

opencli db-password
Example output
# opencli db-password
[✔] Password changed for 3 database account(s)
[✔] Updated /root/.env
[✔] Updated /etc/openpanel/mysql/host_my.cnf
[✔] Updated /etc/openpanel/mysql/container_my.cnf
[✔] Recreated openpanel_mysql
[✔] Restarted OpenPanel
[✔] Restarted OpenAdmin

Without --password a random 32 character password is generated. It changes the password for every root and panel account in mysql.user (all hosts), writes it to MYSQL_ROOT_PASSWORD (and MYSQL_PASSWORD if present) in /root/.env, /etc/my.cnf and /etc/openpanel/mysql/container_my.cnf, recreates the openpanel_mysql container so its environment has the new password, and restarts the openpanel container and the admin service. If the files can't be written or the panel can't connect with the new password, the previous password is restored. The password is never passed on the command line of mariadb or podman, so it doesn't show in the process list.

Set a specific password, 16-128 characters from A-Z a-z 0-9 . _ -:

opencli db-password --password=MyNew.Strong_Password123
Example output
# opencli db-password --password=short
[✘] Password must be 16-128 characters and only contain A-Z a-z 0-9 . _ -

Add --no-restart to only change the password and the files, without recreating openpanel_mysql or restarting OpenPanel and OpenAdmin:

opencli db-password --no-restart
Example output
# opencli db-password --no-restart
[✔] Password changed for 3 database account(s)
[✔] Updated /root/.env
[✔] Updated /etc/openpanel/mysql/host_my.cnf
[✔] Updated /etc/openpanel/mysql/container_my.cnf
[!] Skipped restarts, recreate openpanel_mysql and restart openpanel and admin to apply it everywhere
Was this helpful?