linux 修改mysql密码

初始密码为空,使用空密码登陆mysql执行下列语句


mysql>use mysql;
mysql> UPDATE user SET password=PASSWORD("root") WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit;
修改/opt/lampp/phpmyadmin/config.inc.php


找到如下代码:


$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;
修改为:



$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;




你可能感兴趣的:(linux 修改mysql密码)