我错误地创建了一个我现在无法删除的用户。以下是与MySQL交互的代码片段:
mysql> DROP User 'netbeansuser'@'%';
ERROR 1396 (HY000): Operation DROP USER failed for 'netbeansuser'@'%'
mysql> select User from mysql.user;
+------------------+
| User |
+------------------+
| root |
| root |
| debian-sys-maint |
| netbeansuser |
| root |
| root |
+------------------+
6 rows in set (0.00 sec)
mysql> DROP User 'netbeansuser';
ERROR 1396 (HY000): Operation DROP USER failed for 'netbeansuser'@'%'
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> select User from mysql.user;
+------------------+
| User |
+------------------+
| root |
| root |
| debian-sys-maint |
| netbeansuser |
| root |
| root |
+------------------+
6 rows in set (0.00 sec)
mysql> DROP User 'netbeansuser';
ERROR 1396 (HY000): Operation DROP USER failed for 'netbeansuser'@'%'
mysql> DROP User 'netbeansuser'@'%';
ERROR 1396 (HY000): Operation DROP USER failed for 'netbeansuser'@'%'
我做错了什么?特别是什么是'%'在主机名上签名?我在创建用户时没有指定主机名。了解MySQL用户创建中的主机名绑定的任何资源也会有所帮助。谢谢大家。
答案 0 :(得分:0)
这会有所帮助。
使用'localhost'代替'%'。