http://segmentfault.com/q/1010000000094608
同样的问题,先在网上搜了下其他人解决这个问题的方法,是去修改mysql.cnf文件添加mysql.sock文件路径,再搜了一下我的mac没有mysql.cnf,也没有mysql.sock文件。
在查看mysql的安装说明ReadMe.txt中有个启动方法 If you have installed the Startup Item, use this command: shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(ENTER YOUR PASSWORD, IF NECESSARY)
(PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)
If you don't use the Startup Item, enter the following command sequence: shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(ENTER YOUR PASSWORD, IF NECESSARY)
(PRESS CONTROL-Z)
shell> bg
(PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)
使用sudo的时候会让你输入你的登陆密码。
这样就可以启动
[chopin:~:22:47:07]$ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
Password:
Starting MySQL database server [chopin:~:22:52:06]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.63 MySQL Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  

mac下安装mysql 连接时候报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的更多相关文章

  1. mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法

    首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not conn ...

  2. 长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    mac上安装过mysql: 然而,尝试连接时报错: $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to lo ...

  3. mysql 报错ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ ( ...

  4. MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    [root@pisphkdcbsql01 mysql3307]# /opt/mysql3307/bin/mysql -upisp -ppisp@ mysql: [Warning] Using a pa ...

  5. 启动mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

    mysql之前还好好的,突然就启动不了了,我也很纳闷,原来是服务没有启动 netstat -ntlp 后,发现并没有启动 于是我试着启动mysql service mysqld start 查看了my ...

  6. [ 转载 ] Centos 安装mysql后启动失败 出现 ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

    MySQL Daemon failed to start Mysql出问题一定要学会查看log https://blog.csdn.net/shuai825644975/article/details ...

  7. mariadb报:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111 "Connection refused")

    我这边移除了mysql.sock文件后,重启服务就成功了. 还有一种情况,就是加入galera后,可能是server.cnf配置信息出了问题导致的,修改后,重新运行galera即可,数据库就可以启动成 ...

  8. mysql启动不了:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket

    ps aux |grep mysql kill所有列出的进程,然后重启 service mysql start 原因有可能是mysqld没启动:service mysqld start. 持续出现此问 ...

  9. Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的解决办法

    我的环境:Mac 10.11.6 ,mysql  5.7.14  . mac mySql 报错ERROR 2002 (HY000): Can't connect to local MySQL serv ...

随机推荐

  1. SignalR 2.0 系列: 开始使用SignalR 2.0

    这是微软官方SignalR 2.0教程Getting Started with ASP.NET SignalR 2.0系列的翻译,这里是第四篇:开始使用SignalR 2.0 原文:Getting S ...

  2. PHP实现链式操作的原理

    在一个类中有多个方法,当你实例化这个类,并调用方法时只能一个一个调用,类似: db.php <?php class db{ public function where() { //code he ...

  3. php文本操作方法集合比较

    fgets和fputs.fread和fwrite.fscanf和fprintf 字符串读写函数fgets和fputs 一.读字符串函数fgets函数的功能是从指定的文件中读一个字符串到字符数组中,函数 ...

  4. DataSnap如何监控Tcp/IP客户端的连接情况

    一个实例,如果客户端是TCP/IP是短连接的情况就没有必要了. 一.GlobVar.pas单元,定义应用系统全局数据类型及变量: unit GlobVar; interface uses System ...

  5. WebApp

    目前的手机APP有三类:原生APP,WebAPP,HybridApp:HybridApp结合了前两类APP各自的优点,越来越流行. Hybrid App的兴起是现阶段移动互联网产业的一种偶然.移动互联 ...

  6. C#中窗体的互相访问

    1.在父窗体中构造子窗体对象时,将父窗体传递过去: 如:FrmSub frm=new FrmSub(this);//this代表父窗体 2.将父窗体中要访问的变量和方法修改为public 3.在子窗体 ...

  7. ERROR 23 (HY000) at line 29963: Out of resources when opening file

    在还原数据库时报错,报错信息如下:(库中的表比较多) ERROR 23 (HY000) at line 29963: Out of resources when opening file 解决方法: ...

  8. libcurl

    一.LibCurl基本编程框架 二.一些基本的函数 三.curl_easy_setopt函数部分选项介绍 四.curl_easy_perform 函数说明(error 状态码) 五.libcurl使用 ...

  9. 敏捷开发之道(二)极限编程XP

    上次的博文敏捷开发之道(一)敏捷开发宣言中,我们介绍了一下敏捷开发宣言,在其中,我们了解到了关于敏捷开发的几个重要的价值观.今天我们来了解一个敏捷开发的方法--极限编程XP 1.介绍 极限编程(eXt ...

  10. 在wamp下PHP5.5安装php-redis扩展

    windows下开发用的xampp集成的环境,想装个php-redis扩展,扩展的github地址: https://github.com/nicolasff/phpredis 描述里找到window ...