I am setting up a brand new CentOS 7 LAMP server. I installed phpMyAdmin using yum and epel, following the directions here: https://linuxize.com/post/how-to-install-and-secure-phpmyadmin-with-apache-on-centos-7

I am able to log in to MySQL from the command line no problem, with both root and another user I created that we will call fred. However, when I try to log in to phpMyAdmin via a browser (on the server or on another PC) I get this:

Cannot log in to the MySQL server

That is the extent of the error which makes it very hard to troubleshoot. I have tried logging in with username root, root@localhost, fred, and fred@localhost. I have tried dozens of times doublechecking my passwords which work fine on the command line.

I have searched online and found several posts from people with similar issues, and tried any suggestions I found, none of which helped. I have tried changing different combinations of settings in config.inc.php:

$cfg['Servers'][$i]['host']      = 'localhost';  // (tried
$cfg['Servers'][$i]['auth_type'] = 'cookie';  // (tried http, config)
$cfg['Servers'][$i]['user']      = '';        // (tried root, fred)
$cfg['Servers'][$i]['password']  = '';        // (tried actual password)
$cfg['Servers'][$i]['extension'] = 'mysqli';  // (tried mysql)

With the auth_type set to config, I get a slightly more detailed error:

Error MySQL said: Cannot connect: invalid settings.

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

Thanks for any suggestions!


I found this answer which solved my issue, FYI:

change the auth plugin with: ALTER USER YOUR_MYSQL_USERNAME IDENTIFIED WITH mysql_native_password BY 'YOUR_USER_PASSWORD';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.