初次接触数据库,二进制安装了mysql5.7以后发现无法像yum一样在日志中找回初始密码~so
首先关掉启动的数据库:
在my.cnf中新增一句: skip-grant-tables 保存退出重启mysql
直接用户登录mysql 即可跳过密码
修改密码:
以前我们修改是使用:
update user set password=password('mysqlpwd') where user='root';
但是在5.7版本不存在password字段,所以:
update user set authentication_string=password('mysqlpwd') where user='root';
flush privileges;
最后退出即可