Linux下忘记了mysql的密码,试了几次解决办法,最终从网上找到一个不错的方法
1.首先打开终端 service mysql stop 或者结束进程 利用ps aux | grep mysql 命令得到进程ID号,kill ID号
2.运行 mysql --skip-grant-tables语句
3.重新打开一个终端(Ctrl +alt +T) 输入 mysql -u root mysql
4.进去之后输入UPDATE user SET Password=PASSWORD('your_password') where USER='root'
5.最后重新刷新一下 FLUSH PRIVILEGES