Mysql Can';不要摇摇晃晃

Mysql Can';不要摇摇晃晃,mysql,ubuntu,Mysql,Ubuntu,所以我有一个非常有趣的问题。我试图重置我的MySQL密码,然后我被锁定在MySQL之外。没什么大不了的,我可以卸载MySQL,对吗 错 我跑: sudo apt-get --purge remove mysql-client mysql-server mysql-common sudo apt-get autoremove sudo apt-get autoclean sudo rm -rf /etc/mysql/ 但我在安装大约10分钟后遇到了这个问题: │ Unable to set

所以我有一个非常有趣的问题。我试图重置我的MySQL密码,然后我被锁定在MySQL之外。没什么大不了的,我可以卸载MySQL,对吗

我跑:

sudo apt-get --purge remove mysql-client mysql-server mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /etc/mysql/
但我在安装大约10分钟后遇到了这个问题:

   │ Unable to set password for the MySQL "root" user                                                          │ 
   │                                                                                                           │ 
   │ An error occurred while setting the password for the MySQL administrative user. This may have happened    │ 
   │ because the account already has a password, or because of a communication problem with the MySQL server.  │ 
   │                                                                                                           │ 
   │ You should check the account's password after the package installation.                                   │ 
   │                                                                                                           │ 
   │ Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.

如何正确删除MySQL,以便重新安装?

您只是删除了配置文件。您还需要删除数据库


这些文件通常存储在
/var/lib/mysql
或类似文件中。

您需要删除/var/lib/mysql文件夹

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /var/lib/mysql

我以前也有类似的问题。最后一句话帮助了我。我希望它也能帮助你。

如果这有帮助,试试看:啊,是的,谷歌搜索
卸载mysql ubuntu
没有告诉我。我会尝试一下,然后再联系你这应该行得通,但我相信应该有另一种解决方案,而不必丢失数据,也不必导出和导入。。。我知道OP现在可能不在乎,只是出于好奇。@CodeBird我有两个表,其中有测试数据,我不担心数据保存:)@RUJordan我知道你不在乎,但只是好奇这是否真的是唯一的解决方案,就像想象你在同一个例子中有10个大表,其中有有用的信息。他们在构建mysql时肯定考虑到了这一点:)@CodeBird如果您想保留数据,可以使用
--skip-grants
选项启动mysql。