简体   繁体   中英

Windows mysql workbench can't connect to remote mysql service

I deploy a mysql service on my company remote develop CentOS machine, I'm sure the service is turn on, and it can be access from an other reomte linux machine.

However, I can't connect it from my own Windows PC. I tried mysql workbench client and HeidiSQL client, both failed. I can ping through the remote IP address. I have tried anything I can found on google. Like

But my PC still can't connect to it, which report code 10060 error. So what should I do?

That bind-address = 127.0.0.1 config option means that your mysql server only accepts connections from the localhost , which is your actual CentOS machine. Make sure to set bind-address = 0.0.0.0 .

Also, make sure that:

  • you have connectivity from your windows machine to the CentOS one
  • no firewall blocks the external connections to the local mysql port

Regarding potential security concerns from opening your mysql instance to the whole internet - first make it work, then make it better

I had the same issue here man,and i discovered that we need to create a user that isnt the root user. I my case, i don't know why yet, the issue was that.

The solution

Steps:

1 - Check the firewall (create a rule for port 3306 or disable it).

2 - Comment the line # bind-address=0.0.0.0 at [mysqld] config optin in C:\\ProgramData\\MySQL\\MySQL Server 5.7\\my.ini

3 - Create the user to remote access:

 mysql> CREATE USER 'net'@'%' IDENTIFIED BY '123';
 mysql> GRANT ALL PRIVILEGES ON *.* TO 'net'@'%' WITH GRANT OPTION;

In my case, solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM