无法在Windows上的X.X.X.X上连接到mysql服务器 [英] Can`t connect to mysql server on X.X.X.X on Windows

查看:156
本文介绍了无法在Windows上的X.X.X.X上连接到mysql服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所述,我想远程连接到mysql,它在Windows服务器上,但是出现了此错误消息.

As the title says I want to connect remotely to mysql and it is on windows server but I got this error message.

Cant connect to mysql server on X.X.X.X 我正在用HeidiSql练习

Cant connect to mysql server on X.X.X.X I am tring it with HeidiSql

我已经安装了MariaDB.

I have MariaDB installed.

我还可以使用远程连接连接到服务器.

Also I can connect to server using remote connection.

服务器正在运行,并且可以连接到mysql localy

Server is running and can connect to mysql localy

我尝试了什么:

  1. 我找到了my.ini文件,并检查我是否没有以下命令之一:

Skip-networking

bind-address = some IP

我首先没有在那儿

  1. 我登录了我的MariaDB终端,并使用以下命令向用户授予了所有权限:

  1. I logged in my MariaDB terminal and granted all permisions to user using this:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

我已将端口3306添加到Windows防火墙

I have added port 3306 to windows firewall

我想值得一提的是,我也无法对该服务器执行ping操作 如果我这样做

I guess it is worth mentioning that I cant ping that server either if I do

ping X.X.X.X

它返回:

Pinging X.X.X.X with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for X.X.X.X: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Pinging X.X.X.X with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for X.X.X.X: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

我在论坛上花费了很多时间,并尝试了所有说明,但仍然无法连接.

I have spent many hours on forums and tried all instructions but still cant connect.

任何帮助将不胜感激!

推荐答案

详细的问题可能来自两个不同的原因:

The detailed problem can be from two different causes:

第一个选项:

MySQL绑定到127.0.0.1或根本没有ip.检查Windows cmd上的netstat以查找3306端口,该端口已向mysql进程打开并绑定到您的网络LAN接口或0.0.0.0(不环回/127.0.0.1//:: 1)

MySQL is binded to 127.0.0.1 or no ip at all. Check netstat on windows cmd for locating 3306 port opened to mysql process and binded to your network LAN interface or 0.0.0.0 (not to loopback / 127.0.0.1 // ::1)

要检查netstat,请使用netstat -a -n -o,您也可以在响应中看到进程的PID.

For check netstat, use netstat -a -n -o, you can see in the response the PID of the process too.

要检查MySQL是否在同一台计算机上运行,​​请尝试使用mysql -h 127.0.0.1(用于localhost连接)或mysql -h(您的LAN IP)从本地控制台连接(如果mysql仅绑定到您的LAN IP地址).

For check MySQL is working on the same machine, try to connect from local console using mysql -h 127.0.0.1 (for localhost connection) or mysql -h (your LAN IP) (If you have mysql binded only to your LAN IP address).

第二个选项:

如果第一次测试正常.也许Windows防火墙配置不正确.尝试禁用Windows防火墙(仔细检查一下是否将其禁用).您的问题的错误响应是因为Windows防火墙处于活动状态并阻止了连接.验证后,可以在关闭防火墙的情况下访问3306,将其启用并进行配置.始终检查您是否在所需的网络配置文件上打开端口(请记住,Windows防火墙对于专用/公用连接可以有不同的规则).

If first test are OK. Maybe windows firewall is not configured correctly. Try to disable windows firewall (double check disabling it). The error response on your question are because windows firewall are active and blocking connections. When you have verified you can reach 3306 with firewall off, enable it and configure. Check always you're opening the port on the required network profile (Remember, windows firewall can have different rules for private / public connections).

要检查防火墙配置是否正确,请尝试从LAN上的另一个计算机访问计算机上的3306端口.

For check firewall correctly configured, try to access to the 3306 port on the computer from another comp on the LAN.

如果您的大型LAN网络具有VLAN和类似技术,请检查您的路由拓扑.另外,请记住始终要进行初始检查,请禁用Windows防火墙.您的ping操作失败,因为启用了防火墙.

If you have a huge LAN network with VLANs and similar technologies, check your routing topology. Also, remember always for initial checks, disable windows firewall. Your ping are failing because firewall are enabled.

这篇关于无法在Windows上的X.X.X.X上连接到mysql服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆