Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Other than the obvious, what is the difference between:

drop user user_01@host01;


drop user 'user_01'@'host01';

In a sample test, they both achieved the same result. From Account Names docs (5th bullet point), looks like they are not the same ... yet they appear to do the same thing ... ?

MySQL 5.5 on Centos 6.x.

share|improve this question
up vote 4 down vote accepted

They are identical.

The bullet point you mention states:

The user name and host name parts, if quoted, must be quoted separately. That is, write 'me'@'localhost', not 'me@localhost'; the latter is interpreted as 'me@localhost'@'%'.

And that is what you did, you quoted them separately. In other words, all these are equivalent:

drop user    user_01@host01;

drop user   user_01 @ host01 ;

drop user  'user_01'@'host01';

drop user 'user_01' @ 'host01' ;

And if you wrote:

drop user 'user_01@host01';

... it would be interpreted as:

drop user 'user_01@host01' @ '%';
share|improve this answer
Thanks @Phil. So I'm reading (perhaps incorrectly) the second one as drop the user "user_01@host" logging into the db from host "%" ... which is different from "user_01" logging in from "host01" ... which would be two different commands. Sorry, I am still lost as to how they are identicial ... )-: – KM. Dec 8 '12 at 14:04
They are identical because the parts either side of the @ sign are quoted individually. drop user 'user_01@host01'; has both parts either side of the @ sign between the same quotation marks. Maybe English isn't your native language - the documentation is very clear in this regard. – Phil Dec 9 '12 at 1:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.