Friday, March 25, 2011

#2002 Cannot log in to the MySQL server

If you're getting "#2002 Cannot log in to the MySQL server" when logging in to phpmyadmin on mac os, try editing phpmyadmin/config.inc.php and change:
$cfg['Servers'][$i]['host'] = 'localhost';
to:
$cfg['Servers'][$i]['host'] = '127.0.0.1';

Did the trick for me (after spending 2 hours on it).

11 comments:

  1. Thank you! I've spend nearly 1 hour too. Until happened to spot your post.

    ReplyDelete
  2. Sure thing, I'm glad it helped

    ReplyDelete
  3. I appreciate your help. you save my time as well.
    I search around web and only find yours work.

    ReplyDelete
  4. i cant find editing phpmyadmin/config.inc.php so please tell me what the solution this problem exactly and i am using win7 os

    ReplyDelete
    Replies
    1. Hi Milind,
      Sorry I don't have the answer for this one, I've never actually tried to run it in a Windows environment. If you figure it out though I'd really appreciate you posting the solution here as I am sure someone else could benefit.

      Thanks,
      Ryan

      Delete
  5. This helped me as well! thank you very much

    ReplyDelete
  6. You can also SET SESSION and SET GLOBAL query, in case if you want to make a change while the MySQL is running. dbdesigner.net

    ReplyDelete