问题描述:
今日在10.240.210.60上面远程连接10.240.210.188的数据库时,弹出以下报错
1
|
mysql ERROR 1045 (28000): Access denied
for
user
|
上网搜索后了解到,是由于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; 刷新数据库
Query OK, 0 rows affected (0.00 sec)重新连接即可