mysql5.6 删除用户/ drop user

目录

  • 前言
  • 查看用户
  • 删除用户
  • 删除没有用户名的用户

前言

  • CentOS
  • 5.6.51 MySQL Community Server (GPL)
  • 查看MySQL的版本

查看用户

mysql> select Host,User from user;
+---------------+--------+
| Host          | User   |
+---------------+--------+
| 10.0.101.112  | root   |
| 10.0.101.112  | weixin |
| 5ktsr         | root   |
| ::1           | root   |
| localhost     |        |
| localhost     | root   |
+---------------+--------+
6 rows in set (0.00 sec)

删除用户

mysql> drop user 'root'@'5ktsr';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user 'root'@'127.0.0.1';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

删除没有用户名的用户

mysql> drop user ''@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

你可能感兴趣的:(mysql,mysql)