Wednesday, February 16, 2022

[SOLVED] "Cannot log in to the MySQL server" without code using phpMyAdmin on CentOS7

Issue

I'm setting up a new CentOS 7 server with Apache, MySQL and phpMyAdmin. The installation of MySQL and phpMyAdmin worked as expected. For the installations, I used the following guides by Digital Ocean:

MySQL installation guide

phpMyAdmin installation guide

Loging into MySQL on the server works as expected. However, when I try to log into phpMyAdmin, I only get the "cannot log in to the MySQL server" error, but without a code.

This is a fresh installation of everything, so I am unsure what is causing this problem, since I followed all guides to a t.


Solution

Thanks to user xdk over on the DigitalOcean community forums. They said the following:

Assuming MySQL 8.
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
Reason:
Some applications are having trouble with caching _sha2 _password method.
Above sets the credentials to use the native one.

Executing this did the trick.



Answered By - Niels Kersic
Answer Checked By - Dawn Plyler (WPSolving Volunteer)