- 1130-host … is not allowed to connect to this MySql server
这个问题是因为在数据库服务器中的mysql数据库中的user的表中没有权限(也可以说没有用户),下面记录我的解决方法。
1、连接服务器: mysql -u root -p
2、看当前所有数据库:show databases;
3、进入mysql数据库:use mysql;
4、查看mysql数据库中所有的表:show tables;
5、查看user表中的数据:select Host, User, Password from user; 或 select Host, User from user;
6、修改user表中的Host:update user set Host=’%’ where User=‘root’;
%的意思是root用户可以通过所有主机地址都可以访问。
7、最后刷新一下:flush privileges;
- 1045-Access denied for user ‘root’@’…’(using password: YES)
出现这个问题的原因可能是权限的问题,也就是说你的电脑可能没有权限访问mysql数据库。
grant all privileges on . to ‘root’@‘电脑的ip’ identified by ‘密码’;
或
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ WITH GRANT OPTION
//赋予任何主机访问数据的权限
最后刷新一下:flush privileges;