phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client
In case MySQL Server is up but you are still getting the error:
For anyone who still have this issue, I followed awesome tutorial http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-9-mavericks/
However i still got #1045 error.
What really did the trick was to change localhost
to 127.0.0.1
at your config.inc.php
. Why was it failing if locahost points to 127.0.0.1? I don't know. But it worked.
===== EDIT =====
Long story short, it is because of permissions in mysql. It may be set to accept connections from 127.0.0.1 but not from localhost.
The actual answer for why this isn't responding is here: https://serverfault.com/a/297310
I was experiencing the same problem on OS X. I've solved it now. I post my solution here for anyone who has the similar issue.
Firstly, I set the password for root in mysql
client:
shell> mysql -u root
mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MY_PASSWORD');
Then, I checked the version info:
shell> /usr/local/mysql/bin/mysqladmin -u root -p version
...
Server version 5.6.26
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 11 min 0 sec
...
Finally, I changed the connect_type
parameter from tcp
to socket
and added the parameter socket
in config.inc.php
:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
If you reinstalled the server it means that that the new installation most likely overwrote your username and passwords. (You might want to try loggin without a password see if it works).
If it is a clean install you need to set the root password .
Otherwise, you will need to reset root permissions.