MySQL Drop User Fails for Remote Host

mysql-5.5remoteusers

We're clearing out some old MySQL users that connected from remote hosts during a database transfer.

Why is this DROP USER query failing for the user asdfasdf_imac4? I'm logged in as root.

mysql> select user,host from mysql.user;
+------------------+----------------------+
| user             | host                 |
+------------------+----------------------+
| root             | 127.0.0.1            |
| root             | ::1                  |
| debian-sys-maint | localhost            |
| forum            | localhost            |
| root             | localhost            |
| asdfasdf_imac4   | ‘303.303.303.90’     |
| asdfasdf_imac4   | ‘303.303.303.92’     |
+------------------+----------------------+
7 rows in set (0.00 sec)

mysql> drop user 'asdfasdf_imac4'@'303.303.303.90';
ERROR 1396 (HY000): Operation DROP USER failed for 'asdfasdf_imac4'@'303.303.303.90'

Best Answer

I have never seen an IP address like that before. Since 303 is an impossible number for an IP address, you should just save yourself the headache and delete both from mysql.user

DELETE FROM mysql.user WHERE user='asdfasdf_imac4';
FLUSH PRIVILEGES;

Give it a Try !!!

Related Question