MySQL 重置 root 密码 - 忘记密码

版权声明:转载请注明出处 https://blog.csdn.net/fastlearn/article/details/80511661

原文地址:https://renguangli.com/articles/mysql-reset-root-password

在配置文件/etc/my.cnf添加配置,重启mysql

##无密码登录
skip-grant-tables;

客户端连接mysql选择mysql库

mysql -uroot -p

修改root密码5.7版本,5.7版本之后已经没有了password字段,而是用authentication_string加密字段代替

update mysql.user set authentication_string=password('123qwe') where user='root';

5.7版本以前

update mysql.user set password=password('123qwe') where user='root';

猜你喜欢

转载自blog.csdn.net/fastlearn/article/details/80511661
今日推荐