【发布时间】:2015-06-18 12:55:35
【问题描述】:
我尝试了很多方法,但都失败了。我想从 Windows 连接 VMware 中的 Linux 上的 MySQL。
- VMware:11.1.0 build-2496824
- Linux:Ubuntu 14.10
- Windows:win 8.1 x64
-
MySQL 版本
- windws:5.6.24
- Linux:5.5.43
-
IP
- Windows:192.168.1.102
- Linux:192.168.1.100
PS:Ping 请求相互接收数据包。
当我输入cmd时:
mysql -h 192.168.1.100 -u root_test -p
我确定我输入了正确的密码,但是 mysql 服务器返回“ERROR 1130 (HY000): Host '192.168.1.100' is not allowed to connect to this MySQL Server” 或“ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.100' (10061)”。
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN -
my.cnf:bind-address = 0.0.0.0
service iptables status
iptables: unrecognized service
select user,host from user;
+------------------+---------------+
| user | host |
+------------------+---------------+
| root | 127.0.0.1 |
| root_test | 192.168.1.102 |
| debian-sys-maint | localhost |
| root | localhost |
+------------------+---------------+
show grants for 'root_test'@'192.168.1.102';
+-------------------------------------------------------------------------------------------------------------------------------+
| Grants for root_test@192.168.1.102 |
+-------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root_test'@'192.168.1.102' IDENTIFIED BY PASSWORD 'MD5-PWD' |
+-------------------------------------------------------------------------------------------------------------------------------+
更新
我终于通过在 Windows 上将 IPv4 属性 Obtain an IP address automatically 更改为 use the following IP address 来解决这个问题。
PS:VMware的网络设置是Bridged。
非常感谢@s3v3n 和@Drew Pierce,你们很友善。谢谢。
【问题讨论】:
-
你跑
FLUSH PRIVILEGES了吗? -
是的,我做到了。但它显示
0 rows affected:( -
尝试授予通配符主机:
GRANT ALL PRIVILEGES ON * . * TO 'root_test'@'%'; FLUSH PRIVILEGES; -
顺便问一下,在尝试使用命令行连接时,您是否指定了要连接的主机?像这样:
mysql -u root_test -p -h 192.168.1.100 -
你正试图从 Windows 机器连接到 Linux 机器上的 MySQL 服务器,对吧?