Search code examples
mysqlphpmyadminosx-snow-leopard

mysql password works in Terminal, but not in phpMyAdmin?


I can log in to mysql through Terminal using

mysql -u root -p

I'm prompted with:

Enter password:

When I enter the password I get:

Welcome to the MySQL monitor....

However, when I try to user the same username/password combination into phpMyAdmin I get the rror:

#2002 Cannot log in to the MySQL server

Note: I am using Snow Leopard


Solution

  • Because I am in Snow Leopard, I had to do the following.

    Open Terminal

    cd /etc/
    sudo nano php.ini // or php.ini.default
    Password: (enter my password)
    

    And replace var/mysql/mysql.sock with the following:

    pdo_mysql.default_socket=/tmp/mysql.sock
    mysql.default_socket = /tmp/mysql.sock
    mysqli.default_socket = /tmp/mysql.sock
    

    Then in Terminal

    sudo apachectl restart