Mac Navicat连接Mysql报错:2003 - Can't connect to MySQL server on ……(61 "Connection refused")

出现这个问题的解决办法是重新开启Mysql,如果忘记密码就再设置root密码
1.停掉Mysql

偏好设置->Mysql->Stop Mysql Server
或者 sudo /usr/local/mysql/support-files/mysql.server stop
如果都不行的话就进程直接关掉

2.进入终端输入

cd /usr/local/mysql/bin/
//再输入
sudo su //电脑登录密码
./mysqld_safe --skip-grant-tables & //跳过Mysql验证
./Mysql
//./Mysql这一步后如果密码忘记了可以在这里设置
//8.0版本以后的语法
ALTER user 'root'@'localhost' IDENTIFIED BY 'newpassword';
//8.0版本以前的语法
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');

FLUSH PRIVILEGES;

3.重启Mysql

启动MySQL服务: sudo /usr/local/MySQL/support-files/mysql.server start

停止MySQL服务: sudo /usr/local/mysql/support-files/mysql.server stop

重启MySQL服务: sudo /usr/local/mysql/support-files/mysql.server restart

你可能感兴趣的:(Mac Navicat连接Mysql报错:2003 - Can't connect to MySQL server on ……(61 "Connection refused"))