Skip to content

Instantly share code, notes, and snippets.

@kymtwyf
Created October 15, 2015 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kymtwyf/450d8aeaaaca9305dccf to your computer and use it in GitHub Desktop.
Save kymtwyf/450d8aeaaaca9305dccf to your computer and use it in GitHub Desktop.
reset mysql password in ubuntu, 重置mysql 密码

Reference

Steps

  1. 先关了mysql
sudo /etc/init.d/mysql stop
  1. 进入安全模式
sudo mysqld_safe --skip-grant-tables &
  1. 登录root用户(不用密码)使用mysql库
mysql -uroot mysql
  1. 更新用户名对应的密码
update user set password=PASSWORD("新的密码") where User='root';
  1. FLUSH一下
flush privileges;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment