使用PHPMyAdmin拒绝用户"root"@"localhost"访问

Sam*_*Sam 29 php mysql phpmyadmin wampserver

当我在PHPMyAdmin中设置root密码时,我收到此错误:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)
Run Code Online (Sandbox Code Playgroud)

我无法打开PHPMyAdmin面板.我究竟做错了什么?

Sat*_*mar 84

编辑您的phpmyadmin config.inc.php文件,如果您有密码,请在以下代码中插入密码前面:

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = '**your-root-username**';
$cfg['Servers'][$i]['password'] = '**root-password**';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Run Code Online (Sandbox Code Playgroud)

  • **拒绝编辑:**我在windwos7系统上安装xampp时遇到了同样的错误.我找到的解决方案是:在config.inc.php文件中,我将**$ cfg ['Servers'] [$ i] ['auth_type'] ='config';**替换为$ cfg ['Servers'] [$ i] ['auth_type'] ='cookie'; 然后一切正常......如果有同样的问题,请测试你的运气... (13认同)
  • 在wamp中,对于那些难以获得config.inc文件的人来说,它存在于\ wamp\apps\phpmyadmin \文件夹中. (4认同)