mysql> update user set user='root' where host='%';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user;
+-------------+------+
| host | user |
+-------------+------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| centosnode2 | root |
+-------------+------+
4 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> update user set password='root' where host='%';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user;
+-------------+------+
| host | user |
+-------------+------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| centosnode2 | root |
+-------------+------+
4 rows in set (0.00 sec)
mysql> select host,user ,password from user;
+-------------+------+-------------------------------------------+
| host | user | password |
+-------------+------+-------------------------------------------+
| % | root | root |
| centosnode2 | root | *E2238AA1A058543BA0CF696A99FB4A6CDAD37B10 |
| 127.0.0.1 | root | *E2238AA1A058543BA0CF696A99FB4A6CDAD37B10 |
| ::1 | root | *E2238AA1A058543BA0CF696A99FB4A6CDAD37B10 |
+-------------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql>
本文展示了如何使用MySQL命令更新用户信息,并验证更改效果。通过具体的SQL语句操作,包括更新用户名、密码及刷新权限等,演示了用户管理的基本流程。
911

被折叠的 条评论
为什么被折叠?



