1

I keep trying to connect to my MySQL Database use POPSQL, and I keep getting the error code ECONNREFUSED (Error Connection Refused) M.Y.I.P:3306, and I can't figure out why. The set up is a follows:

I'm running Plesk, on Cent OS, which uses a MySQL DB (Maria), which I normally connect to using PHPMyAdmin using the Plesk interface.

Now I'm trying to connect to it using this POPSQL, but I've not been able to connect remotely using any applications.

My troubleshooting:

1: Restart Server: Many times, and after each change.

2: Check firewall: It's enabled, running, and port 3306 is open (I also tried connecting over SSH, which I can do in a terminal, but not POPSQL or any other SQL Connection software)

3: Check Plesk Config: Credentials are right, remote connections are allowed through any host Plesk DB config

4: Check Maria config, bind address is 0.0.0.0 instead of 127.0.0.1

[mysqld]
bind-address = 0.0.0.0
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

My knowledge of DB troubleshooting ends there, so if you have any ideas or recommendations as to whats going on and how to fix it please let me know. Again, I'm pretty new to all of this so I'm sure it's just a simple mistake, but an extra set of eyes would be extremely helpful.

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • what errormessage you get. have you check **telnet dbIP 3306** to connect to the db-server. only to test if the connection is ok ? – Bernd Buffen Dec 30 '21 at 19:59

1 Answers1

1

I'm not good with firewalls and that shows.

I was editing the default firewall zone "public" instead of "plesk," the one controlling traffic for this server.

For future reference:

1: Check what zones are active.

firewall-cmd --get-active-zones

2: Edit the active zone

firewall-cmd --zone=plesk **OR whatever your zone is called** --add-port=3306/tcp --permanent

2.5: Make sure it says success

firewall-cmd --zone=plesk --add-port=3306/tcp --permanent 
success

3: Reload firewall

firewall-cmd --reload

Credit to Bernd Buffen for pointing me in the right direction.

Don't forget the basics!