Remote MySQL connection fails (10060) - "Can't connect to MySQL server on domainname.com(10060)"
I have developed an application in VB6, and am using an online MySQL database server for storing my application's data.
The first time I try to connect to my database server is successful, but after closing my application and starting it again I get:
Can't connect to MySQL server(10060)"
After some time (approximately 30 minutes), I can successfully connect to the database again.
- I have given maximum values to all of MySQL system and global variables like connection_timeout, wait_timeout etc.
- I have granted all permissions to my MySQL user.
- The firewall on my computer is turned off.
- All connections are properly closed when the application closes.
I have asked the technical people who provide the Online MySQL Database service and they gave me these three reasons:
- The local machine from where you are trying to connect is not whitelisted on the server.
- The maximum number of connections for the user has been exceeded.
- The MySQL server was down at the time (though they said that their server was not down).
How can I solve the first two reasons, or determine that they are the cause of the problem? Or could there be another problem not listed there?
see this link i found : https://superuser.com/questions/1364906/mysql-error-10060-oracle-linux-mysql-8 I solve my Problem with it.
you need to make sure there is:
1) user created that has remote access for example [email protected]'x.x.x.x'
2) there is a connection from the two machine ( they can ping each other for example or access each another by another method) the port is opened between the two machine
my.ini/my.cnfthere is blocking connection parameter like:
4) the service is up and running when you try to connect from the other machine
Most probably this is a networking side issue and the database service provider needs to create a new rule in firewall (iptables). Still we just need to confirm few things from the provider. As the behavior is not steady (on occasion you can connect, and sometimes not). So its not a user privilege issue (GRANT ALL ON ...)
- Make sure they have included MySQL listening port in to unblock/exception list of firewall. Most commonly it is 3306
- Try increasing the max_connection parameter in my.cnf
- In my.cnf make sure 'skip-networking' is commented out, Also bind-address = 127.0.0.1
- What is the output if we use the following from command line telnet ip_mysql_server 3306
on windows telnet is most probably not available: use powershell PS C:\Windows\system32> New-Object System.Net.Sockets.TcpClient("ip_mysql_server", 3306) Client : System.Net.Sockets.Socket Available : 78 Connected : True <== this indicates that you can reach the server ExclusiveAddressUse : False ReceiveBufferSize : 65536 SendBufferSize : 64512 ReceiveTimeout : 0 SendTimeout : 0 LingerState : System.Net.Sockets.LingerOption NoDelay : False
First check whether you given proper privileges to the user on your current host through which you are trying to connect to MySQL server.
- Check your hostname first
- Then login into the MySQL through super user like 'root'
- Check whether the privileges are provided or not
select * from mysql.user where host="host_name"\G;
- Give all privileges first, then try to connect again.
grant all on *.* to 'user'@'host_name' identified by 'Password';
I hope this is helpful to you.
some hosting providers block by default, the remote access to his MySql servers by security reasons. If you need to unblocking the remote access service tell them for unblocking this service.
Otherwise, test your app locally, as localhost and when this works fine, change the hostname, and so on database parameters in your app, and upload to your web hosting server, thats works fine!!!.
Take care, that your Database design checks with your local database design, this is very important!!!
I hope this is helpful to you.