mysql> Grant all privileges on *.* to 'root'@'%' identified by ******* with grant option;
Query OK, 0 rows affected (0.02 sec) (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名)
mysql> Grant all privileges on *.* to 'mysql'@'%' identified by ******* with grant option;
Query OK, 0 rows affected (0.02 sec) (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名)
mysql> flush privileges; (运行为句才生效,或者重启MySQL)
Query OK, 0 rows affected (0.03 sec)
mysql> select host,user from user; (再次查看用户的权限情况)
+-------------+-------+
| host | user |
+-------------+-------+
| % | mysql |
| % | root |
| localhost | |
| localhost | root |
| localhost | |
| localhost | mysql |
+-------------+-------+
mysql>exit
Query OK, 0 rows affected (0.02 sec) (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名)
mysql> Grant all privileges on *.* to 'mysql'@'%' identified by ******* with grant option;
Query OK, 0 rows affected (0.02 sec) (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名)
mysql> flush privileges; (运行为句才生效,或者重启MySQL)
Query OK, 0 rows affected (0.03 sec)
mysql> select host,user from user; (再次查看用户的权限情况)
+-------------+-------+
| host | user |
+-------------+-------+
| % | mysql |
| % | root |
| localhost | |
| localhost | root |
| localhost | |
| localhost | mysql |
+-------------+-------+
mysql>exit