redconservatory
redconservatory

Reputation: 21924

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

Upvotes: 0

Views: 1861

Answers (3)

redconservatory
redconservatory

Reputation: 21924

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

Upvotes: 1

Kowser
Kowser

Reputation: 8261

It might happen when, there is no controluser configured for phpMyAdmin in your database.

By default it is like below from config file.

$cfg['Servers'][$i]['controluser'] = 'pma';

You can also check existing database users by following query:

select * from mysql.user;

Wish it will help.

Upvotes: 0

dvhh
dvhh

Reputation: 4750

I think that either the root is disabled by default on remote host (considering that your mysql server and your http server are on different host), or the remote root password is different from the one on localhost (same reason). It would be a way better to create a new admin user rather than using root remotely (the new username is obviously less easy to guess).

Upvotes: 1

Related Questions