mac 安装并使用 mysql 或者 mac mysql 忘记密码,Can't connect to local MySQL server through socket homebrew...

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"

 

转载于:https://www.cnblogs.com/wangjiale1024/p/10192574.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值