首先說明下mysql用戶的相關信息是保存在mysql數據庫的user表中的,並且該表的密碼字段(Password)是通過PASSWORD方法加密存儲的。
明白了以上提示,那麼修改密碼就簡單了,直接運行如下SQL語句即可(這裏將密碼修改爲root):
UPDATE user SET password=PASSWORD('root') 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'] = 'root'; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['AllowNoPassword'] = true;
轉載自: http://www.jb51.net/article/49340.htm