MySQL remote access (ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”))

Issues related to applications and software problems
Post Reply
oscar_ovb
Posts: 3
Joined: 2018/01/30 16:09:09

MySQL remote access (ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”))

Post by oscar_ovb » 2018/01/30 16:34:29

I've tried several posts to configure remote access, but still nothing works:
Content of /etc/my.cnf file:

Code: Select all

[mysqld]
skip_name_resolve
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
port=3306

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
As you can see there's no bind-addresss or skip-networking stuff. Here are my "iptables":

Code: Select all

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql
ACCEPT     tcp  --  1.1.1.2              1.1.1.1             tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
As you can see, I've tried different "iptables" commads but still nothing works

I created two users, both at '%', so when I access the server via putty, I can log into MySQL with those users and do what they are allowed to do, so it's not a privileges problem, I think.

The port is definitely listening:

Code: Select all

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2694/mysqld
I'm trying to connect with Workbench on a Windows machine. Any other idea? Any help will be apreciated.

User avatar
TrevorH
Forum Moderator
Posts: 22806
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: MySQL remote access (ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”))

Post by TrevorH » 2018/01/30 16:57:30

Generally speaking it's a bad idea to open the port to remote users if this is an internet connected system. In that case it's better to add bind-address=127.0.0.1 and use an ssh tunnel to connect to 127.0.0.1:3306 on the remote machine.

What error message do you get?
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

oscar_ovb
Posts: 3
Joined: 2018/01/30 16:09:09

Re: MySQL remote access (ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”))

Post by oscar_ovb » 2018/01/30 17:43:36

The thing is that I need to upload data from an Arduino board, and I'm using the MySQL Connector, and there will be several arduinos uploading data, thats why I need to open the port. I'm using Workbench or command prompt on Windows to test remote connection, but I get ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”).

oscar_ovb
Posts: 3
Joined: 2018/01/30 16:09:09

Re: MySQL remote access (ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.XX.XX' (10060 “Unknown error”))

Post by oscar_ovb » 2018/01/30 19:44:09

Also, the port seems to be open with "iptables -L" but when I type "service mysqld status" it returns "service mysqld is stopped", even if I type "service mysqld start". When I do an online test to see which ports are opened, port 3306 says it's closed.

Post Reply