Why I can't log in MYSQL with phpmyadmin?

2019-09-05 06:22发布

问题:

I have a problem. I can log in MYSQL by SHELL or Adminer (root or not-root user, whatever). But I can't with phpmyadmin. 'Cannot log in to the MySQL server'. What can be wrong? P.S. Passwords are valid.

回答1:

First Step: check if port 3306 is open. If not then either you can open port 3306 by doing entry in iptables or simply you can stop this service (if not using any other purpose) by below command.

$ service iptables stop

Second Step: User should have permission to connect from your ip, if not then provide rights as per below-

> grant select,insert,update,delete on your_db.* to your_user@'your_ip' identified by 'your_password';

If this is not production server then initially you can provide globally full rights to check the problem by below command-

> grant all privileges on *.* to your_user@'%' identified by 'your_password';


回答2:

The error "Cannot log in to the MySQL server" can have multiple causes. It simply means, that phpMyAdmin is not able to connect to the MySQL Server in general.

There are two causes I know:

  1. flawed settings in the Config.inc.php file (solution)

  2. the MySQL server rejects any queries, because the root password needs to be updated (solution)