![]() |
|
Guide Change MySQL Passwords on CyberPanel Without Breaking phpMyAdmin or Your Site - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CyberPanel (https://adminsforum.com/Forum-cyberpanel) +---- Forum: CyberPanel Guides & Tutorials (https://adminsforum.com/Forum-cyberpanel-guides-tutorials) +----- Forum: CyberPanel Databases & phpMyAdmin Guides (https://adminsforum.com/Forum-cyberpanel-databases-phpmyadmin-guides) +----- Thread: Guide Change MySQL Passwords on CyberPanel Without Breaking phpMyAdmin or Your Site (/Thread-guide-change-mysql-passwords-on-cyberpanel-without-breaking-phpmyadmin-or-your-site) |
Change MySQL Passwords on CyberPanel Without Breaking phpMyAdmin or Your Site - JAY - 11-14-2026 Change MySQL Passwords on CyberPanel Without Breaking phpMyAdmin or Your Site (Tested) Two password changes cause a lot of trouble on CyberPanel servers: changing the MySQL root password (afterwards phpMyAdmin won't open and you can't create databases), and changing a website's database password (the site shows "Error establishing a database connection"). We did both on purpose on a CyberPanel 3.0.8 server (Ubuntu 24.04, MariaDB 10.11), watched what broke, and fixed it. Here's what to change, and where. Part 1: A website's database password In the panel this lives under Databases → List Databases. Pick the website and use the Change button next to the database: The panel changes the password in MariaDB. It does not know your website's config file, so the site keeps using the old one. We tested the same thing over SSH. Right after the password change, our WordPress site answered: Code: 500
Error establishing a database connectionCode: stat -c %UCode: cd /home/yourdomain.com/public_html
sudo -u SITEUSER wp config set DB_PASSWORD 'your-new-password'
Code: .envCode: configuration.phpPart 2: The MySQL root password CyberPanel itself logs in to MariaDB as root to create databases and to open phpMyAdmin for you. It reads that password from its own files. If you change the password only in MariaDB, the panel is left with the old one. What broke on our server after changing only the root password:
The three places to update. Back them up first: Code: mkdir -p /root/rootpw-backup
cp -a /etc/cyberpanel/mysqlPassword /root/.my.cnf /usr/local/CyberCP/CyberCP/settings.py /root/rootpw-backup/Code: mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-new-password'; FLUSH PRIVILEGES;"
Code: systemctl restart lscpdCode: mysqlThe trap in settings.py On a fresh install, the first block in that DATABASES section (user Code: cyberpanelCode: cyberpanelCode: settings.pyChange only the Code: rootdbCode: cyberpanelCode: /etc/postfix/mysql-virtual_*.cfCode: /etc/dovecot/dovecot-sql.conf.extCode: /etc/powerdns/pdns.confCode: /etc/pure-ftpd/phpMyAdmin won't open? Check this first If phpMyAdmin bounces you back to the dashboard, or database creation fails, test whether the panel's saved root password still works: Code: mysql -uroot -p"$(cat /etc/cyberpanel/mysqlPassword)" -e "SELECT 1;"Code: 1Code: /home/cyberpanel/error-logs.txtQuestions, or a different error after a password change? Reply below with the last lines of that log (hide passwords and your server IP). |