Arth Arth - 1 year ago 77
MySQL Question

phpMyAdmin: Cannot log into the MySQL server no error code

I recently copied my mysql db into a new data directory and changed a few settings.

I also accidentally deleted my user directory /home/user and had all the fun of the fair recreating that.

I can now connect to mysql on the command line but cannot connect via phpMyAdmin.
I get the message:

Cannot log in to the MySQL server

I have seen this before, but not without the error code #1045 or #2002 prepended.

Would there be any logs or documentation anywhere about this message without an error code?


phpMyAdmin is installed on the same server and prompts the web user for a username/password in the browser login page, on submit with the correct details it returns to this login page with the error message displayed.

I have tried changing the
line to:

$cfg['Servers'][$i]['host'] = ''; // previously 'localhost'

I have also tried
to no avail.

Answer Source

Finally fixed it, after much confusion.

Turns out, my my.cnf file was binding the address to our server's internal network IP.

bind-address = 192.168.etc

Previously, before moving the database (and socket location), it was also connecting with 'localhost' correctly (which uses the socket) and allowing login from phpMyAdmin.

After moving the db, the socket connection didn't work, and changing the line to from localhost causes mysql to connect with TCP instead of the socket. This now caused conflict with the bind-address:

$cfg['Servers'][$i]['host'] = ''; // previously 'localhost'

Removing the bind-address restriction allowed me to login.

A better solution however, was of course to fix the socket connection.

After fussing over permissions for a while, and asking around, someone help me find a setting in mysqli.ini (the extension phpMyAdmin uses to connect to the db):

mysqli.default_socket = /new/location 

This fixed the localhost socket connection and I could reinstate my my.cnf bind-address and revert to use 'localhost' again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download