mysql的 密码不记得了,已经不能正常打开 了,使用重置密码进行修改,还是不行。

进行了mysql的卸载和重装:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)

sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server mysql-client

然后正常登录就可以了。

mysql -uroot -p 新密码

注意:在

/etc/mysql/debian.cnf文件中有明文密码,输入的不是这个密码,而是新设的密码,自定义。

参考:access denied for user debian-sys-maint

根据上面这篇文章,可以知道mysql希望获得的是新的密码,而不是文件中的初始密码。