卸载命令:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
vim /etc/hostconfig
执行完上面命令后使用的是Vim指令,复制上述命令,保存,退出即可。
继续完成下列指令:
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
安装登录拒绝的问题:
terminal设置环境变量:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
1、停止mysql服务
2、用emacs新建my.cnf文件写完后将文件放入/etc/目录下,其中文件内容如下:
[mysqld]
skip-grant-tables
3、 etc目录下执行sudo chmod 777 my.cnf
4、重启mysql服务
5、进入终端,输入 mysql -u root -p 回车,输入原来的密码登录
6、FLUSH PRIVILEGES;
7、ALTER USER 'root'@'localhost' IDENTIFIED BY '你要重置的密码';
8、FLUSH PRIVILEGES;
9、退出mysql,然后重启mysql服务
CREATE USER 'sap' @'%' IDENTIFIED BY 'sap';-- 创建用户
CREATE DATABASE sap DEFAULT CHARSET utf8 COLLATE utf8_general_ci;-- 创建数据库
GRANT ALL PRIVILEGES ON `sap`.* TO 'sap' @'%' IDENTIFIED BY 'sap';-- 分配数据库权限
FLUSH PRIVILEGES;
--远程登录拒绝
update user set host = '%' where user ='root' limit 1;
flush privileges;
select 'host' from user where user='root';
或者
mysql>use mysql;
mysql>update user set host='%' where user='root' AND host='localhost';
mysql>FLUSH PRIVILEGES;