mysql root更改远程登录

mysql> select user,host from mysql.user;
+---------------+-------------+
| user          | host        |
+---------------+-------------+
| call          | %           |
| sysbench      | %           |
| repl          | xxx.xxx.xx% |
| mysql.session | localhost   |
| mysql.sys     | localhost   |
| root          | localhost   |
+---------------+-------------+
6 rows in set (0.00 sec)

mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> grant all privileges on *.* to 'root'@'%' ;
ERROR 1133 (42000): Can't find any matching row in the user table
mysql>
mysql>
mysql>
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'XXX' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> select user,host from mysql.user;
+---------------+-------------+
| user          | host        |
+---------------+-------------+
| call          | %           |
| root          | %           |    ---->安全问题,要注意
| sysbench      | %           |
| repl          | 172.31.50.% |
| mysql.session | localhost   |
| mysql.sys     | localhost   |
| root          | localhost   |
+---------------+-------------+
7 rows in set (0.00 sec)

 

posted @ 2018-09-11 11:43  monkeybron  阅读(1106)  评论(0编辑  收藏  举报