![]() |
|
Guide CyberPanel Remote MySQL Access: Why the Panel Setting Alone Doesn't Work (Tested) - 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 CyberPanel Remote MySQL Access: Why the Panel Setting Alone Doesn't Work (Tested) (/Thread-guide-cyberpanel-remote-mysql-access-why-the-panel-setting-alone-doesn-t-work-tested) |
CyberPanel Remote MySQL Access: Why the Panel Setting Alone Doesn't Work (Tested) - JAY - 10-27-2026 CyberPanel Remote MySQL Access: Why the Panel Setting Alone Doesn't Work (Tested) You want to connect to a CyberPanel database from somewhere else: your PC with HeidiSQL or DBeaver, a reporting tool, an app on a second server. CyberPanel has a Remote Access button for every database, so it looks like a one-click job. On our lab server (CyberPanel 3.0, MariaDB 10.11, Ubuntu 24.04) that button changed exactly one thing, and the connection still failed. You need three things, and we tested each one from a second server. Short version:
Before you start: do you really need it? An open database port gets scanned and brute-forced like SSH. If you only need it now and then from your own PC, an SSH tunnel needs none of the steps below: in HeidiSQL or DBeaver choose "MySQL over SSH tunnel", or run Code: ssh -L 3306:127.0.0.1:3306 root@YOUR-SERVER-IPCode: 127.0.0.1:3306Step 1: Allow the user from your IP (the panel part) Databases > List Databases, choose the website, and click Manage under Remote Access next to the database. Enter the IP address the connection will come from. Code: %Code: 192.168.1.%Code: %The Remote Access window, before saving: We used Code: 203.0.113.25Code: localhostAfter saving, it lists only the new host: It wasn't. The panel added a second user with the same name and password for that IP, and gave it all rights on this one database. Code: localhostCode: 127.0.0.1What the panel really changed: And that's all the button did. MariaDB still listened on Code: 127.0.0.1:3306Code: ERROR 2003 (HY000): Can't connect to MySQL server on 'YOUR-SERVER-IP:3306' (113)Step 2: Let MariaDB listen on the network On CyberPanel the setting is in Code: /etc/mysql/mariadb.conf.d/50-server.cnfCode: grep -n '^bind-address' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i 's/^bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf
systemctl restart mariadb
ss -ltn | grep 3306Code: 0.0.0.0:3306Code: 127.0.0.1:3306Now MariaDB accepts connections from everywhere, but the firewall still blocks them. In our test the second server still got error 2003 at this point. That's what you want: next, open it for your IP only. Step 3: Open 3306 for one IP in the firewall Don't add 3306 in CyberPanel's Security > Firewall page: that opens it to the whole internet. Use a rule that only matches your address (CyberPanel uses firewalld): Code: CLIENT=203.0.113.10 # the IP that will connect
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=$CLIENT port port=3306 protocol=tcp accept"
firewall-cmd --reload
firewall-cmd --list-rich-rules | grep 3306From the second server, the port was now open. The error changed, and that's the useful part, because each error tells you which step is still missing:
A client-side trap: MySQL 9 can't log in to MariaDB Our second server had the MySQL 9.0 command line client. It got past the network and host checks and then stopped with: Code: ERROR 2059 (HY000): Authentication plugin 'mysql_native_password' cannot be loadedCode: apt install mariadb-clientTurn it off again When you don't need remote access any more, undo all three steps, in reverse: Code: firewall-cmd --permanent --remove-rich-rule="rule family=ipv4 source address=$CLIENT port port=3306 protocol=tcp accept"
firewall-cmd --reload
sed -i 's/^bind-address.*/bind-address = 127.0.0.1/' /etc/mysql/mariadb.conf.d/50-server.cnf
systemctl restart mariadb
mysql -e "DROP USER 'dbuser'@'203.0.113.10'"Code: SELECT User, Host FROM mysql.userCode: localhostCode: 127.0.0.1Checklist
More CyberPanel guides
|