日期:2014-05-16  浏览次数:20760 次

修改xampp中mysql的密码

MySQL 的“root”用户默认状态是没有密码的,所以在 PHP 中您可以使用 mysql_connect("localhost","root","") 来连接 MySQL 服务器;
如果您想为 MySQL 中的“root”用户设置密码,请在控制台中使用“mysqladmin”命令。例如:

\...\xampp\mysql\bin\mysqladmin -u root password secret

请注意,更改 root 的密码之后,不要忘记更改 PHPMyAdmin 中的相关信息。在 \...\xampp\phpmyadmin\ 下搜索“config.inc.php”并编辑下面几行:

$cfg['Servers'][$i]['user'] = 'root'; // MySQL SuperUser
$cfg['Servers'][$i]['auth_type'] = 'http'; // HTTP MySQL authentification

从今往后,需要正确输入“root”的密码才能启动 PHPMyAdmin