1. brew install mysql

2. 启动mysql mysql.server start

我遇到了这个error,查openstack解决,我在这粘一下

### Error:Can't connect to local MySQL server through socket homebrew

When you got the server running via

mysql.server start

you should see the socket in /tmp/mysql.sock. However, the system seems to expect it in /var/mysql/mysql.sock. To fix this, you have to create a symlink in /var/mysql:

sudo mkdir /var/mysql

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

3. 配置密码等 mysql_secure_installation

4. 如果忘记密码,简单点,删除再装可以吧

删除

  • sudo rm /usr/local/mysql

其实这一句就够了,以防万一,所有可能的地删除一遍

  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /private/var/db/receipts/*mysql*

5.  安装mysql-python

pip install mysql-python

遇到两个error

1)“config.h” not  found

解决办法:

  brew install mysql-connector-c

  

CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install MySQL-python==1.2.5

2)“pip install mysql-python“   fails with  ’IndexError‘

By finding out the information that mysql-connector-cmight come to the conclusion that the configuration by brew installation may be incorrect , open the /usr/local/bin/mysql_config script to modify some of the contents of it:

#Create options
Libs = "-L $ pkglibdir "
Libs = " $ libs -l"

change into:

#Create options
Libs = "- L $ pkglibdir"
Libs = "$ libs -lmysqlclient -lssl -lcrypto"

 

mac 安装并使用 mysql 或者 mac mysql 忘记密码,Can't connect to local MySQL server through socket homebrew的更多相关文章

  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. Mac下Mysql启动异常["ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"]

    在mac下使用brew安装mysql,之前没有使用过,今天启动的时候发现启动不了 huijundeMacBook-Pro:bin huijunzhang$ mysql ERROR (HY000): C ...

  3. 长久不用的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 ...

  4. 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’ ( ...

  5. 解决Mysql错误:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

    需要重启服务器:sudo /etc/init.d/mysql restart

  6. MySQL无法启动:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    1 详细异常 ct 11 17:31:51 bd02.getngo.com mysqld[20513]: 2019-10-11T09:31:51.187848Z 0 [Note] /usr/sbin/ ...

  7. 启动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 ...

  8. 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 ...

  9. mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.sock' (111)

    之前装了mysql,今天打开mysql的时候报了个Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.s ...

  10. 安装mysql后ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

    ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ------------------------------------- ...

随机推荐

  1. Centos剔除在线用户

    CentOS踢除已登录用户的方法: 1.>先按下w查看用户终端号 2.>执行pkill -kill -t pts/1 (pts/1为w指令看到的用户终端号)命令

  2. Java/sql找出oracle数据库有空格的列

    1.java方式 String table_sql = "select table_name from user_tables";//所有用户表 List<String> ...

  3. Android中怎么破解游戏之修改金币数

    我们在玩游戏的时候总是会遇到一些东东需要进行购买的,但是我们可能又舍不得花钱,那么我们该怎么办呢?那就是用游戏外挂吧!我们这里说的是Android中的游戏,在网上搜索一下移动端游戏外挂,可能会找到一款 ...

  4. APIO2019

    device: 用最小公倍数的知识或是画网格模拟转移,神仙们也可以找规律.然后就变成区间覆盖了. 忘记特殊情况了,大众分→Ag #include<iostream> #include< ...

  5. fiddler对浏览器、app抓包及证书安装

    1.fiddler对浏览器抓包 1.1 对浏览器的http的抓包 Capturing开启,进行抓包: Capturing关闭,停止抓包: 如下图:  1.2 对浏览器的https抓包 1.2.1 开启 ...

  6. 重新学习Mysql数据库4:Mysql索引实现原理和相关数据结构算法

    本文转自互联网 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial ...

  7. RFS自动化测试工具安装与使用总结

    转载:http://blog.csdn.net/a5650892/article/details/77826021 一,调试1,在调试时,总时提示“无法打开浏览器”解决办法:1,把浏览器的代理关闭2, ...

  8. (10)centos7 包管理、远程传文件

    一.RPM red package manager 红帽包管理工具 -q 查询 -a 已安装的所有rpm 1.查询已安装的rpm列表 -qa 查看所有的rpm安装包 rpm -qa | grep py ...

  9. 机器学习基石笔记:Homework #3 LinReg&LogReg相关习题

    原文地址:http://www.jianshu.com/p/311141f2047d 问题描述 程序实现 13-15 # coding: utf-8 import numpy as np import ...

  10. jenkins集成sonar代码审核工具

    在项目测试管理过程中,项目上线很多时候时间仓促,导致代码质量不高,测试时间不充分会导致线上出现各种各样的问题,这个时候一方面是增加测试的质量把控,还要从根本上解决开发小哥的代码质量问题.而Sonar这 ...