Linux下忘记mysql密码该如何修改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密码该如何修改mysql密码的相关内容,希望对大家有所帮助。

参与评论