重置Mysql密码
- Linux系统
- 停止MySQL进程
#service mysqld restart
或# /etc/init.d/mysql stop 或 # killall -TERM mysqld(不推荐)
- 以安全模式启动MySQL
# mysqld_safe –skip-grant-tables & 或, # mysqld_safe --skip-grant-tables >/dev/null 2>&1 &
- 登陆MYSQL
# mysql -u root 或, # /usr/local/mysql/bin/mysql -u root mysql
- 更改ROOT密码
use mysql; select host, user, password from user; update user set password=password(“newpassword”) where user=”root” flush privileges;
- 退出控制台,重启MYSQL服务
service mysqld restart 或, /etc/init.d/mysql restart