1. 停到运行的mysql: /etc/init.d/mysql stop很文博客-https://www.zhenjiekeji.com/51741.html
2. 使用skip-grant-tables这个选项启动MySQL: /usr/bin/mysqld_safe --skip-grant-tables &很文博客-https://www.zhenjiekeji.com/51741.html
3. 现在可以不用密码进入mysql 了。很文博客-https://www.zhenjiekeji.com/51741.html
# myql很文博客-https://www.zhenjiekeji.com/51741.html
> use mysql;很文博客-https://www.zhenjiekeji.com/51741.html
> UPDATE user SET password=password('123456') WHERE user='root'; //密码修改为123456;很文博客-https://www.zhenjiekeji.com/51741.html
> FLUSH PRIVILEGES;很文博客-https://www.zhenjiekeji.com/51741.html
> quit;//退出mysql
4. 重启mysql : /etc/init.d/mysql restart
现在就可以用mysql -uroot -p123456登陆了。
我的微信
微信号已复制
扫一扫更精彩
大家的支持是我更新的动力!!!



