建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > PHP学习 > Mysql提示is not allowed to connect to this MySQL server

Mysql提示is not allowed to connect to this MySQL server

时间:2015-05-18 10:16:56  来源:免费模板网 作者:风雪 阅读次数 tagsmysql错误

在项目开发中遇到mysql报is not allowed to connect to this MySQL server解决办法如下。
如果我们mysql提示s not allowed to connect to this MySQL server错误意思是数据库没有连接权限了,只需要把权限设置一下就可以解决了.

如果你想连接你的mysql的时候发生这个错误:

ERROR 1130: Host ‘192.168.33.60’ is not allowed to connect to this MySQL server

解决方法:

1,改表法,可能是你的帐号不允许从远程登陆,只能在localhost,这个时候只要在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称”%”,代码如下:

  1. mysql -u root -pvmware 
  2. mysql>use mysql; 
  3. mysql>update user set host = ‘%’ where user = ‘root'; 
  4. mysql>select host, user from user;  

2.授权法,例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话,代码如下:

GRANT ALL PRIVILEGES ON *.* TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;

如果你想允许用户myuser从ip为192.168.33.60的主机连接到mysql服务器,并使用mypassword作为密码,代码如下:

  1. GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.33.60′ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION
  2. GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.33.61′ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
  3.  

 

本文地址:https://www.freemoban.com/php/2015/0518/1895.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!