忘记密码,怎么在mac卸载mysql

如题所述

1.修改配置文件 my.cnf 来跳过登录密码进入数据库

[root@localhost /]# vim /etc/my.cnf

在 [mysqld] 段中加上:skip-grant-tables

2.然后登录数据库时就不需要密码了

3.进入 mysql 命令行之后 执行:

use mysql;

update user set password=password('123456') where user='root' and host='localhost';

给 root 用户添加密码 123456

4.然后执行:

update user set password=password('123456') where user='root' and host='%';

将远程连接的密码设置为 123456


然后就正常卸载就可以

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-01-24

你好,可以做出以下尝试:

1 sudo rm /usr/local/mysql
2 sudo rm -rf /usr/local/mysql*
3 sudo rm -rf /Library/StartupItems/MySQLCOM
4 sudo rm -rf /Library/PreferencePanes/My*
5 vim /etc/hostconfig  (and removed the line MYSQLCOM=-YES-)
6 rm -rf ~/Library/PreferencePanes/My*
7 sudo rm -rf /Library/Receipts/mysql*
8 sudo rm -rf /Library/Receipts/MySQL*
9 sudo rm -rf /var/db/receipts/com.mysql.*