当前位置:Gxlcms > mysql > xampp中修改mysql默认空密码(root密码)的方法分享_MySQL

xampp中修改mysql默认空密码(root密码)的方法分享_MySQL

时间:2021-07-01 10:21:17 帮助过:4人阅读

XAMPP

参考了网上提供的一些方法,发现说的都挺复杂。下面同大家分享一种简单快捷的方法。

首先说明下mysql用户的相关信息是保存在mysql数据库的user表中的,并且该表的密码字段(Password)是通过PASSWORD方法加密存储的。

明白了以上提示,那么修改密码就简单了,直接运行如下SQL语句即可(这里将密码修改为bitsCN.com):


UPDATE user SET password=PASSWORD('bitsCN.com') WHERE user='root';



经过以上操作,密码就修改了。

如果你希望以后直接输入localhost/phpMyadmin还能直接进入phpMyadmin的管理界面而不用输入用户名和密码的话,还需要进行如下操作:

找到phpMyadmin的配置文件,即phpMyAdmin目录下的config.inc.php,找到如下代码:


/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;


/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'bitsCN.com';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

人气教程排行