mysql 拒绝连接 怎么办_mysql连接拒绝问题

mysql中在其它机器连接mysql服务器时报错问题汇总 一、[running]root@192.168.9.136:~$mysql -uroot -h 19

mysql中在其它机器连接mysql服务器时报错问题汇总

一、[running]root@192.168.9.136:~$mysql -uroot -h 192.168.9.108 -p   //带-p参数,在下一步进行密码输入

Enter password:    //无字符串输入

ERROR 1045 (28000): Access denied for user 'root'@'192.168.9.136' (using password: NO)

此问题原因是在192.168.9.136这台机器的mysql中没有对192.168.9.136访问授权,可以直接登录数据库服务器192.168.9.108通过命令连到数据库授权

授权方法如下:

mysql>  grant all privileges on *.* to 'root'@'192.168.9.136' identified by 'test' with grant option;

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

如果在执行grant语句授权报如下错误时:

ERROR 1045 (28000): Access denied for user 'root'@'192.168.9.108' (using password: YES)

则可以使用如下命令查看当前登录用户的权限:

mysql> show grants;

+--------------------------------------