1.使用root登陆mysql
2.
mysql> select user,host,password from mysql.user;
+--------+-----------+-------------------------------------------+
| user
| host
| password
|
+--------+-----------+-------------------------------------------+
| root
| localhost | *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| root
| Emily
| *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| root
| 127.0.0.1 | *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| pengyi | 127.0.0.1 |
|
+--------+-----------+-------------------------------------------+
mysql> grant all on *.* to 'pengyi'@'localhost';
mysql> select user,host,password from user;
+--------+-----------+-------------------------------------------+
| user
| host
| password
|
+--------+-----------+-------------------------------------------+
| root
| localhost | *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| root
| Emily
| *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| root
| 127.0.0.1 | *5FE6B3E9169F4FBE38D17F5E7E5DF54CE5C9CFDE |
| pengyi | localhost |
|
| pengyi | 127.0.0.1 |
|
+--------+-----------+-------------------------------------------+