1

I'm using a mac and recently installed phpmyadmin and mysql. While trying to login using root on http://localhost/~Shreyas/phpmyadmin/ I get the following errors.

Cannot log in to the MySQL server

mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

In the config.inc.php file I tried changing

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

to,

$cfg['Servers'][$i]['host'] = '127.0.0.1';

I then got the following error.

mysqli_real_connect(): (HY000/2002): Connection refused

I even added this line:

$cfg['Servers'][$i]['AllowNoPassword'] = true;

I tried the following links but none of the answers mentioned seemed to work. I also changed the port to 3307 and 3306. None of them worked.

PHP Warning: mysqli_connect(): (HY000/2002): Connection refused `

phpMyAdmin on MySQL 8.0

This is my first attempt at php and mysql. Any help is appreciated.

EDIT: I uninstalled mysql and re-installed it. Now it works.

3.14159
  • 267
  • 6
  • 22
  • To be clear, you're saying that you tried all of the presented solutions in [phpMyAdmin on MySQL 8.0](https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0)? If so, what exactly were the results? What exact version of MySQL are you running? – Patrick Q Jul 16 '18 at 12:57
  • "In the config.inc.php file I tried changing" — Change it back. You just added an additional problem on top of the one you already had. – Quentin Jul 16 '18 at 13:01
  • I'm using the version 8.0.11 and I changed "In the config.inc.php file I tried changing" this back – 3.14159 Jul 16 '18 at 13:06

1 Answers1

2

Since one of 5.7.x branch small versions there was introduced big change in how mysql works on that matter. You can't anymore log in with root account to phpmyadmin. Workaround is to create new user with all privileges. For example for myself i've created a user named "altroot", assigned to it all permissions and set up a password. I'm able to log in to phpmyadmin with such user. To do this:

mysql -u root -p

and then set up user and password (in this command word password should be replaced with a password with which you want to log in):

CREATE USER 'altroot'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON * . * TO 'altroot'@'localhost';

FLUSH PRIVILEGES;

Later probably i will update this post with more details.

spectatorx
  • 373
  • 2
  • 7
  • 22