mysql5.7 找回密码

初次接触数据库,二进制安装了mysql5.7之后发现没法像yum同样在日志中找回初始密码~somysql

首先关掉启动的数据库:sql

在my.cnf中新增一句: skip-grant-tables  保存退出重启mysql数据库

直接用户登陆mysql 便可跳过密码ide

修改密码:日志

之前咱们修改是使用:
ip

update user set password=password('mysqlpwd') where user='root';string

可是在5.7版本不存在password字段,因此:it

update user set authentication_string=password('mysqlpwd') where user='root';io

flush privileges;table

最后退出便可

相关文章
相关标签/搜索