简体   繁体   English

无法连接到 Windows 上的远程 MySQL 服务器

[英]Can't connect to remote MySQL server on Windows

I'm trying to set up a MySQL server on Windows that will allow another computer to connect to it remotely.我正在尝试在 Windows 上设置一个 MySQL 服务器,以允许另一台计算机远程连接到它。 The client computer is getting a 'Can't connect to MySQL server' error in MySQL Workbench.客户端计算机在 MySQL Workbench 中收到“无法连接到 MySQL 服务器”错误。

Both computers are on the same network, and the server is using a static IP address (I have forwarded ports in my router to allow external connections to the public IP address).两台计算机都在同一网络上,并且服务器使用的是静态 IP 地址(我在路由器中转发了端口以允许外部连接到公共 IP 地址)。

What I've tried (suggested by other threads):我尝试过的(由其他线程建议):

  • In my.ini, setting bind-address = 0.0.0.0 / commenting out bind-address / commenting out skip-networking在 my.ini 中,设置bind-address = 0.0.0.0 / 注释掉bind-address / 注释掉skip-networking
  • Running GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD';运行GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD'; . . When I run this, I get the error Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in a future release ;当我运行它时,我收到错误Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in a future release ; however I can confirm that in Workbench, the user's privileges are all checked (under the 'Users and Privileges' screen).但是我可以确认在 Workbench 中,用户的权限都被选中(在“用户和权限”屏幕下)。
  • In my router settings, forwarded port 3306 on the server's static IP address在我的路由器设置中,转发了服务器静态 IP 地址上的端口 3306
  • Disabling the Windows Firewall on the server.禁用服务器上的 Windows 防火墙。
  • Verified that the MySQL Server Windows Service is running.验证 MySQL 服务器 Windows 服务正在运行。

Can anyone advise?任何人都可以建议吗?

Ref: Try connecting with mysql cli instead of work bench from the remote machine, so u can isolate that cli client ur able to access the remote DB.参考:尝试从远程机器连接 mysql cli 而不是工作台,这样你就可以隔离能够访问远程数据库的 cli 客户端。 because the following reason might be causing connectivity issue in Workbench.因为以下原因可能会导致 Workbench 出现连接问题。

mysql cli cmd install mysql.exe client program from cmd prompt> mysql -hhostname -uusername -ppass dbname mysql cli cmd 从 cmd 提示符安装 mysql.exe 客户端程序> mysql -hhostname -uusername -ppass dbname

Cannot connect to Database server (mysql workbench) 无法连接到数据库服务器(mysql 工作台)

In MySQL Workbench (5.2.47 CE)在 MySQL Workbench (5.2.47 CE) 中

click Mange Server Instances (bottom right corner)单击管理服务器实例(右下角)

click Connection点击连接

in the Connection box select:在连接框中选择:

Local Instance ($ServerName) - root@127.0.0.1:3306 '<'Standard(TCP/IP)>本地实例 ($ServerName) - root@127.0.0.1:3306 '<'标准(TCP/IP)>

click Edit Selected...单击编辑选定...

under Parameters, Hostname change localhost or 127.0.0.1 to your NetBIOS name在参数下,主机名将 localhost 或 127.0.0.1 更改为您的 NetBIOS 名称

click Test Connection点击测试连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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