(linux)修改MySQL密码方法

1,在/etc/my.cnf末尾  加入skip-grant-tables,保存,跳过身份验证。

2,重启MySql,使刚才修改的配置生效。

3,终端输入mysql,然后再输入use mysql;

4,终端输入update mysql.user set authentication_string=password('123456') where user='root';

5,在/etc/my.cnf末尾  去掉skip-grant-tables,保存。

6,重启MySql,终端输入 mysql -u root -p ,然后根据提示输入刚设置的密码即可正常使用了。

原文地址:https://www.cnblogs.com/sz-xioabai/p/7018820.html