MySQL找回密码

  1. 通过service mysql stop停止mysql的服务
  2. /usr/bin/mysqld_safe --skip-grant-tables&       跳过安全检验机制(此时不要关闭当前终端,另开新的终端
  3. 设置密码) #mysql >use mysql; >update user set password=password('在这里写上要设置的新密码') where user='root                                         >flush privileges;                                                                                                                                                                              >exit
  4. 然后再登录mysql:#mysql -u root -p;                                                                                                                                                     Enter password: ‘输入你设置的密码’ 
  5. 重启mysql服务
原文地址:https://www.cnblogs.com/yueliming/p/3068889.html