问题描述:
今日在10.240.210.60上面远程连接10.240.210.188的数据库时,弹出以下报错
1
<code>mysql ERROR 1045 (28000): Access denied </code><code>for</code> <code>user</code>
上网搜索后了解到,是由于10.240.210.188没有给10.240.210.60这台机器赋予连接权限引起的。
【解决办法】
在10.240.210.188连上mysql
[root@openvas ~]# mysql -uroot -ppassword
赋予10.240.210.60连接权限
1)查看权限信息
mysql> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*83947472A627808D9FC03023210C4C369F0CAA5D' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
2)赋予相应权限
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.240.210.60' IDENTIFIED BY PASSWORD '*83947472A627808D9FC03023210C4C369F0CAA5D' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; 刷新数据库
重新连接即可
<a href="http://s3.51cto.com/wyfs02/M02/73/60/wKioL1X7s_yyqqAZAAQ9eQs_d4Y073.jpg" target="_blank"></a>
本文转自 xoyabc 51CTO博客,原文链接:http://blog.51cto.com/xoyabc/1696035,如需转载请自行联系原作者