# 更改配置文件,使得无密码登录 vim /etc/my.cnf #在[mysql]下加入以下语句 skip-grant-tables=1 # 更新root密码 update user set authentication_string = password('123456'), password_expired = 'N', password_last_changed = now() where user = 'root'; # 如果出现错误 ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column # 使用下面的命令,就能免去错误 set sql_safe_updates=0; flush privileges ;