标签:mysql 数据库 mysql.sock mac
在Mysql下有时候会出现mysql.sock位置错误,导致无法链接数据库。
mac下报错的时候:
首先修改my.cnf
位置在/etc/my.cnf下,假如没有的话,去/usr/locate/mysql版本/my.cnf下修改,然后复制到/etc下。
修改为如下:
[client] socket = /tmp/mysql.sock [mysqld] socket = /tmp/mysql.sock
然后重启mysql服务,打开mysql看看位置变了没~用,status查看
mysql Ver 14.14 Distrib 5.6.17, for osx10.7 (x86_64) using EditLine wrapper Connection id: 24 Current database: Current user: root@localhost SSL: Not in use Current pager: less Using outfile: '' Using delimiter: ; Server version: 5.6.17 MySQL Community Server (GPL) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /tmp/mysql.sock Uptime: 15 min 51 sec
在:
pdo_mysql.default_socket=/tmp/mysql.sock mysql.default_socket = /tmp/mysql.sock mysqli.default_socket = /tmp/mysql.sock
然后
sudo apachectl stop sudo apachectl start
看phpinfo()下mysql.sock是否变了~
标签:mysql 数据库 mysql.sock mac
原文地址:http://blog.csdn.net/alps1992/article/details/40409117