在配置文件/etc/my.cnf添加配置,重启mysql
##无密码登录
skip-grant-tables
客户端连接mysql选择mysql库
mysql -uroot -p
use mysql;
修改root密码5.7版本,5.7版本之后已经没有了password字段,而是用authentication_string加密字段代替
update mysql.user set authentication_string=password('root') where user='root';
5.7版本以前
update mysql.user set password=password('root') where user='root';
本文介绍如何通过配置文件实现MySQL无密码登录,并提供了针对不同版本更新root用户密码的方法。对于5.7版及其以后版本,使用authentication_string字段进行密码设置;5.7版之前则使用password字段。
1万+

被折叠的 条评论
为什么被折叠?



