Mysql从客户端连接服务器连不上的问题
报的错误为
ERROR 1130: Host ’192.168.5.3’ is not allowed to connect to this MySQL server
www.2cto.com
查过资料后发现这个问题,一般都会遇到,My
sql数据库跟其他数据库不一样,需要设置权限可以控制哪台机器能访问数据库,能访问哪些表。
所以就要登上服务器。
C:\Documents and Settings\Administrator>
mysql -h localhost -u root -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.43-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
www.2cto.com
mysql> grant all privileges on *.* to root@'%' identified by '123' with grant
-> option;
Query OK, 0 rows affected (0.00 sec)
意思就是将服务器上的所有资源都给root用户权限,%代表来自不同的IP
这里需要注意一下要把密码也要带上。通过密码123登录。
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
最后要刷新下权限。
这样就从本地192.168.5.3这个IP的客户端连接到服务器上了
在尝试从本地客户端连接到服务器上的Mysql时遇到了ERROR 1130错误,问题通常由于MySQL的权限控制导致。解决方法是登录服务器上的MySQL,使用grant命令赋予root用户从任意IP地址访问所有资源的权限,并指定密码,然后执行FLUSH PRIVILEGES刷新权限,从而允许远程连接。
707

被折叠的 条评论
为什么被折叠?



