Super User is a question and answer site for computer enthusiasts and power users. 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

I connected mysql on Mac OS X using this command:

mysql -u root -p -h

After I logged in, I fired up this command:

select user();

and it showed:


and even wired, I already change the root password on via SET PASSWORD command.

When I typed in

show grants for 'root'@'';

the password did change in the result.

However, I still have to use the old password to log in with the following command:

mysql -u root -p -h


  • Could you tell me why this happened?
  • Is there anything wrong here?
share|improve this question
up vote 2 down vote accepted

Connecting to MySQL using requires the TCP/IP protocol.

The problem is that the mysql client tries to outsmart you by saying

  • If you specify and do not tell me the protocol, I will use the socket and behave like a localhost connection.
  • If you specify and tell me to use TCP/IP, THEN I will use a TCP/IP connection

In light of this, you must connect as follows:

mysql -u root -p -h --protocol=tcp

to verify this, please run this after connecting


Both should say root@ (how do I see which user I am logged in as in MySQL?)

Give it a Try !!!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .