0

I mistakenly created a user that I now am unable to delete. Following is the code snippet interacting with 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'@'%'

What am I doing wrong? Particularly, what is the '%' sign at the hostname for? I didn't specify the hostname while creating the user. Any resources on understanding hostname bindings in MySQL USER creation will also help. Thanks all.

1 Answers1

1

This will be helpful.

Use 'localhost' instead of '%'.

Saravana Kumar
  • 3,669
  • 5
  • 15
  • 35