“#2002 Cannot log in to the MySQL server” on login

2019-06-13 18:44发布

问题:

I am trying to setup drupal on windows 8 with XAMPP but when I try to login to phpmyadmin, I get this error:

I've tried so many different things but I can't seem to get it working. Both Apache and MySQL are running fine from the XAMPP Control Panel.

回答1:

If you're on a fresh install, config.inc.php file may not exist. You need to rename/copy config.sample.inc.php file then change the relevant line.

please check below link:

phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin.



回答2:

Your phpMyAdmin has been configured with an administrative user ('controluser') to access some advanced features of phpMyAdmin. However, it does not appear that user exists in MySQL. This suggests that XAMPP has had some glitch in installation, as I believe the XAMPP package normally configures this all for you.

The solution is rather easy; edit your config.inc.php and comment out a few lines by adding // to the beginning of each line. You should do that for the configuration directives for 'controluser', 'controlpass', and 'pmadb', then re-try.

Once you're connected, you can either decide to add the controluser manually or just leave things how they are and not have access to the more advanced features such as bookmarking queries, favorite tables, and so on.



回答3:

This specific error can have multiple causes.

In your case I think the following settings might be wrong:

  • username
  • password
  • host
  • port

Just open the config.inc.php in your phpMyAdmin folder and double check the following lines:

$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['user'] = 'USER';
$cfg['Servers'][$i]['password'] = 'PASSWORD';

Another possible solution you might want to try, could be my answer to this question: enter link description here