2

I'm unable to delete one of my MySQL users. When using phpMyAdmin (using GUI), I'm getting an infobox, that user has been successfully deleted (thus it seems, that pMA is unable to catch error returned by MySQL), but after refreshing page, user is still there.

Attempt to delete this user with:

DROP USER 'undeletable_user'@'localhost';

from either phpMyAdmin's SQL console or directly from command line mysql client ends up with pretty meaningless (at least to me) message:

ERROR 1396 (HY000): Operation DROP USER failed for 'undeletable_user'@'localhost'

Meaningless, because I already know, that I'm unable to delete this user or that this operation fails. However, I'm trying to figure out, why I can't delete to or to get more information.

What can I do in this situation?

trejder
  • 17,148
  • 27
  • 124
  • 216
  • 1
    Did you try reset/flush the `privileges`? – Keep Coding Mar 25 '15 at 06:56
  • Attempt to delete using an old method: mysql> DELETE FROM mysql.user WHERE User='' AND Host='my-computer-hostname.local'; Similar inquiry on mysql.com http://lists.mysql.com/mysql/218882 – Rcls Mar 25 '15 at 06:57
  • Possibly flushing `privileges` may solve your problem easily. You can try `flush privileges;` – Keep Coding Mar 25 '15 at 07:01
  • @Testing I admit, that I didn't flushed privileges. But, since this is a development machine, which was restarted about 20 times (I'm trying to delete this user for about month), I assume, no flushing is required as it should be flushed every time MySQL goes down (and up next day), right? – trejder Mar 25 '15 at 08:36
  • @Testing Sir, yes, sir! :> Flushing from either pMA or mysql command line brought no effect. User still exists. – trejder Mar 25 '15 at 08:42
  • @Rcls My Windows' user is `trejder`, therefore, I tried your query with both approaches: `AND Host='localhost'` and `AND Host='trejder.local';` brought no effect. `Query OK, 0 rows affected (0.00 sec)` in both cases and user still exists in pmA. This can be confirmed by executing `SELECT * FROM mysql.user;` from command line, which lists this user among others. This user has no password and editing it in pMA shows `The selected user was not found in the privilege table.` warning. This user has no password and no privileges. I can't login using it. Editing it in pMA fails (changes not saved). – trejder Mar 25 '15 at 08:49
  • Sorry for being late. Did you get your problem resolved? – Keep Coding Mar 25 '15 at 09:35
  • Can you try below command? `GRANT USAGE ON *.* TO 'username'@'localhost'; DROP USER 'username'@'localhost';` – Keep Coding Mar 25 '15 at 09:35
  • @Testing Me2! :> Nahahaha, did so! Result? `Query OK, 0 rows affected (0.00 sec)` two times and user still exists! Nahaaha! :> Want screenshot to believe, that I'm not lying? :> – trejder Mar 25 '15 at 10:38
  • 1
    Ok, finally I have bookmarked something for you. :) Can you give it a try once. [See this answer](http://stackoverflow.com/questions/598190/mysql-check-if-the-user-exists-and-drop-it/605819#605819) – Keep Coding Mar 25 '15 at 10:44
  • @Testing Nope, this not work also. I used this procedure with and without user-recreation part (last). Query is executed. User remains. If that wouldn't be possible, I'd say, that something keeps recreating that user in my MySQL. I think, we have to pass on this matter, because we used probably everything. Thanks! – trejder Mar 25 '15 at 11:06
  • ahhhaan... well its very strange problem you are suffering with. Hope you will solve it later. lets pass it for now. You welcome. :) – Keep Coding Mar 25 '15 at 11:07
  • @trejder PLEASE MARK AND UP-VOTE THE ANSWER FOR OTHERS HELP. THANKS – Alive to die - Anant Feb 03 '16 at 07:03

0 Answers0