mysql> use mysql;
Database changed
mysql> grant all privileges on *.* to root@'%' identified by "password";
可以指定某一个数据库
grant all privileges on 数据库.表 to root@'%' identified by "指定的密码";
grant all privileges on your_db.* to root@'%' identified by "password";
your_db的所有表
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,password from user;
+--------------+------+-------------------------------------------+
| host | user | password |
+--------------+------+-------------------------------------------+
| localhost | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| % | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
+--------------+------+-------------------------------------------+
3 rows in set (0.00 sec)