连接到本地MySQL服务器

连接到本地MySQL服务器

本文介绍了优胜美地-MAMP-无法通过套接字'/Applications/MAMP/tmp/mysql/mysql.sock'连接到本地MySQL服务器(2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试连接到MySQL MAMP时遇到问题:

I have problem when I try to connect to MySQL MAMP :

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

我正在做研究,但是我没有找到解决问题的方法,我尝试像这样链接mysql.sock:

I'm doing research but I have not found a solution to my problem, I try to link mysql.sock like this :

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

但是,文件/tmp/mysql.sock不存在.

But, the file /tmp/mysql.sock doesn't exist.

您有什么主意吗?问题使我无法使用了2天,这次我进行了搜索,但对我没有好处.

Do you have any ideas ? The problem is blocking me for 2 days, I searched for this time but nothing good for me.

预先感谢

推荐答案

我遇到了同样的问题.我按照以下步骤解决了该问题:

I had the same problem. I solved it following these steps:

  1. 我通过系统偏好设置-> MySQL停止并重新启动了MySQL(另请参见 https://stackoverflow.com/a/26523977/204807 )
  2. 我在终端窗口中输入sudo mysql_upgrade,然后按
  1. I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
  2. I entered sudo mysql_upgrade in a terminal window, and pressed

在更新过程之后,我可以连接到我的MySQL.

After the update process I was able to connect with my MySQL.

这篇关于优胜美地-MAMP-无法通过套接字'/Applications/MAMP/tmp/mysql/mysql.sock'连接到本地MySQL服务器(2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:08