Issue ODBC Connection to MariaDB on Windows PC fails

PeterK900

Basic Pleskian
Server operating system version
AlmaLinux9
Plesk version and microupdate number
Version 18.0.70 Update #2
Testing the ODBC connection produces the message "Cannot connect to server". Error log [Sun Jul 06 06:09:16.438625 2025] [authz_core:error] [pid 3245906:tid 3245958] [client 34.162.213.107:0] AH01630: client denied by server configuration: /var/www/vhosts/xxxx.com/httpdocs/.git
The database I'm trying to connect to has the setting "Allow remote connections from any host".
In the past editing the bind-address in my.cnf has solved failure to connect. Commenting the line out or setting it to ::ffff:0.0.0.0 does not solve the problem.
I have no problems in creating a working ODBC connection using AlmaLinux9 on a server with cPanel. In the past (Centos7) I have managed successful ODBC connections on a Plesk server.
Can anyone help with what I might be doing wrong? Thanks.
 

Attachments

  • odbc fail.PNG
    odbc fail.PNG
    47.7 KB · Views: 7
The web server message is unrelated to the ODBC connection issue. Discard the web server aspect.

If you cannot connect to port 3306 while on your server the database server is listening, make sure that no firewall is blocking port 3306 on your server. When I test your IP from my computer, I cannot connect to port 3306 on your server:
1. Open Windows Powershell
2. Run this command: Test-NetConnection -ComputerName 46.32.255.248 -Port 3306
results in failed connection. This means that port 3306 is not open on your machine or on a firewall in front of your machine.
 
The web server message is unrelated to the ODBC connection issue. Discard the web server aspect.

If you cannot connect to port 3306 while on your server the database server is listening, make sure that no firewall is blocking port 3306 on your server. When I test your IP from my computer, I cannot connect to port 3306 on your server:
1. Open Windows Powershell
2. Run this command: Test-NetConnection -ComputerName 46.32.255.248 -Port 3306
results in failed connection. This means that port 3306 is not open on your machine or on a firewall in front of your machine.
Thanks for your help.
Running the Powershell comand you cite gives me the same result. But when I repeat the command but with the ip address of a web server where ODBC connectivity works, the test connection works. So, my understanding is that port closure/firewall problem you write about relates to the web server, rather than the pc making connection. So what I need to do is open 3306 on the webserver - true? If so, can you provide any links on how to do this in Plesk. Thanks again for your help so far.
 
Let's first get the terminology clear. With "web server" you probably mean the host computer. Let's call it "host" or "host computer", because the "web server" opposed to "mail server", "ftp server", "database server" are just separate services (software) on the host computer. These do not have a firewall. The host computer has a firewall. Plus, your data center might have a firewall in front of the host computer. So even if port 3306 is open on your host computer (which is very likely the case), there might still be a block in the datacenter's firewall for that host computer.

Here are a few options how to find out whether port 3306 is open on your host computer. If it is open on your host computer, very likely traffic is blocked in a firewall in front of that host computer in your data center:

✅ Option 1: Use nc (netcat) from a remote machine

From another machine (not the server itself), run:

nc -zv your_server_ip 3306

-z: Zero-I/O mode (scan mode)

-v: Verbose output

Example:

nc -zv 192.168.1.100 3306

If port is open, you'll see something like:

Connection to 192.168.1.100 3306 port [tcp/mysql] succeeded!

✅ Option 2: Use telnet (if installed)

From a remote machine:

telnet your_server_ip 3306

If the port is open, the screen will go blank or show a MySQL handshake response.
If closed or filtered, you'll get a connection error.

✅ Option 3: Use nmap from another host

nmap -p 3306 your_server_ip

Output example if open:

PORT STATE SERVICE
3306/tcp open mysql

✅ Option 4: Use ss or netstat on the server (to check listening status)

ss -tuln | grep 3306

or

netstat -tuln | grep 3306

This tells you if MySQL is listening, but does not confirm if it is accessible from outside. You must test externally to confirm that.

✅ Option 5: Use iptables or ufw to check firewall rules

Example for iptables:

sudo iptables -L -n | grep 3306

For ufw:

sudo ufw status | grep 3306
 
Thanks for clarifying my confusing terminology. And for your wide range of command line tests.
In the end I opted for sudo ss -tulpn | grep LISTEN run on the host where ODBC connectivity fails. This command shows...
tcp6 0 0 0.0.0.0:3306 :::* LISTEN 3237821/mariadbd
which seems to suggest 3306 is open on the server. Therefore it looks like a firewall problem which perhaps I need to raise with the hosting company?
 
"Web Application Firewall" only affects web server traffic (ports 80, 443). It does in no way influence database port 3306.

Yes, contacting your hosting company might help.
 
"Web Application Firewall" only affects web server traffic (ports 80, 443). It does in no way influence database port 3306.

Yes, contacting your hosting company might help.
Thanks for clarifying the Web Application Firewall setting. I'll raise this issue with the hosting company and post back when I know more. Thanks again.
 
Back
Top