查看:

SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

删除:

drop user 'username'@'host';

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+-----------------------------------+
| query                             |
+-----------------------------------+
| User: 'root'@'127.0.0.1';         |
| User: 'slaveuser'@'192.168.15.%'; |
| User: 'root'@'::1';               |
| User: 'username'@'host';          |
| User: ''@'localhost';             |
| User: 'root'@'localhost';         |
| User: ''@'vm-linux-t';            |
| User: 'root'@'vm-linux-t';        |
+-----------------------------------+
8 rows in set (0.00 sec)

mysql> drop user 'username'@'host';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+-----------------------------------+
| query                             |
+-----------------------------------+
| User: 'root'@'127.0.0.1';         |
| User: 'slaveuser'@'192.168.15.%'; |
| User: 'root'@'::1';               |
| User: ''@'localhost';             |
| User: 'root'@'localhost';         |
| User: ''@'vm-linux-t';            |
| User: 'root'@'vm-linux-t';        |
+-----------------------------------+
7 rows in set (0.00 sec)

mysql>

相关文章:

  • 2022-12-23
  • 2021-09-21
  • 2021-10-10
  • 2022-01-07
  • 2021-07-03
  • 2021-09-10
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-08-24
  • 2021-12-10
  • 2022-03-04
相关资源
相似解决方案