telnet mysql时出现:is not allowed to connect to this MySQL serverConnection closed by foreign host问题的解决 telnet mysql时出现:is not allowed to connect to this MySQL serverConnection closed by foreign host问题的解决

telnet mysql时出现:is not allowed to connect to this MySQL serverConnection closed by foreign host问题的解决

转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/77854690 
本文出自【我是干勾鱼的博客

有时候telnet一个mysql服务器的时候会出现:

Host '192.168.0.1' is not allowed to connect to this MySQL serverConnection closed by foreign host.
  • 1

如图:

这里写图片描述

这个原因是因为索要链接的mysql数据库只允许其所在的服务器连接,需要在mysql服务器上设置一下允许的ip权限,如下:

1.连接mysql

mysql -u root -p
  • 1

如图:

这里写图片描述

2.授权

grant all privileges on *.* to 'root'@'192.168.0.1' identified by '123456';
  • 1

如图:

这里写图片描述

当然,如果想给所有ip都赋予权限,则这样:

grant all privileges on *.* to 'root'@'%' identified by '123456';
  • 1

3.使授权立即生效

flush privileges;
  • 1

如图:

这里写图片描述

然后再远程telnet或者连接这个mysql数据库就可以成功了。

参考:

http://www.cnblogs.com/zhangzhu/archive/2013/08/22/3274831.html

https://www.duoluodeyu.com/2324.html

转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/77854690 
本文出自【我是干勾鱼的博客

有时候telnet一个mysql服务器的时候会出现:

Host '192.168.0.1' is not allowed to connect to this MySQL serverConnection closed by foreign host.
  • 1

如图:

这里写图片描述

这个原因是因为索要链接的mysql数据库只允许其所在的服务器连接,需要在mysql服务器上设置一下允许的ip权限,如下:

1.连接mysql

mysql -u root -p
  • 1

如图:

这里写图片描述

2.授权

grant all privileges on *.* to 'root'@'192.168.0.1' identified by '123456';
  • 1

如图:

这里写图片描述

当然,如果想给所有ip都赋予权限,则这样:

grant all privileges on *.* to 'root'@'%' identified by '123456';
  • 1

3.使授权立即生效

flush privileges;
  • 1

如图:

这里写图片描述

然后再远程telnet或者连接这个mysql数据库就可以成功了。

参考:

http://www.cnblogs.com/zhangzhu/archive/2013/08/22/3274831.html

https://www.duoluodeyu.com/2324.html

猜你喜欢

转载自blog.csdn.net/hu_jinghui/article/details/81048574