分类目录归档:mysql

Mysql 忘记root密码怎么办?

Mysql 忘记root密码怎么办? 在服务器shell首先关闭mysql服务。

service mysql stop

然后使用非授权模式打开mysql服务器,

bin/safe_mysqld --skip-grant-tables & 

mysql    -u root
> use mysql
> update user set password=password("new_pass") where user="root";  
> exit;

退出mysql,然后重启mysql服务

servie mysql restart

这时就可以用新的密码登录mysql了