默认安装的web集成包,如wamp server或xampp这类软件,mysql的密码默认是为空的,为了数据库安全我们必须设置一个密码,设置成功后,phpmyadmin会登不了,此时我们只需要在phpmyadmin的配置文件中,修改密码,重启mysql服务即可。
默认是config.inc.php文件。里面内容为:
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
将$cfg['Servers'][$i]['password'] = ''; 设置成你修改的密码,保存后关闭,即可