mysql5.7数据库删除用户及其权限 drop user ‘root‘@‘%‘; flush privileges;
Posted 闭关苦炼内功
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql5.7数据库删除用户及其权限 drop user ‘root‘@‘%‘; flush privileges;相关的知识,希望对你有一定的参考价值。
mysql5.7.27数据库想要删除用户的所有权限,只需两步操作
Step1:删除用户及其权限
drop user 'root'@'%';
Step2:生效
flush privileges;
以下是详情:
- 删除前
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+------------------------------------+
| query |
+------------------------------------+
| User: 'root'@'%'; |
| User: 'demo'@'%'; |
| User: 'mysql.session'@'localhost'; |
| User: 'mysql.sys'@'localhost'; |
| User: 'root'@'localhost'; |
+------------------------------------+
5 rows in set (0.00 sec)
mysql>
- 开始删除
mysql> drop user 'root'@'%';
Query OK, 0 rows affected (0.36 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.40 sec)
mysql>
- 删除后
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+------------------------------------+
| query |
+------------------------------------+
| User: 'demo'@'%'; |
| User: 'mysql.session'@'localhost'; |
| User: 'mysql.sys'@'localhost'; |
| User: 'root'@'localhost'; |
+------------------------------------+
4 rows in set (0.00 sec)
mysql>
追更
写完这篇文章,突然发现之前写过一篇文章包含了
我们下期见,拜拜
以上是关于mysql5.7数据库删除用户及其权限 drop user ‘root‘@‘%‘; flush privileges;的主要内容,如果未能解决你的问题,请参考以下文章