There are sometimes mysql.sock location errors under MySQL, which prevents the database from being linked.
Mac error When:
First modify the MY.CNF
Location under/ETC/MY.CNF, if not, go to/usr/locate/mysql version/my.cnf under Change, and then copy to/etc.
The changes are as follows:
[Client]socket =/tmp/mysql.sock[mysqld]socket =/tmp/mysql.sock
If there is no [client], add it yourself ~
Then restart the MySQL service, open MySQL to see if the location has changed to use, Status View
MySQL Ver 14.14 distrib 5.6.17, for osx10.7 (x86_64) using editline wrapperconnection id:24current Database: Current User:[email protected]ssl:not in usecurrent pager:lessusing outfile: ' Using delimiter:; Server version:5.6.17 MySQL Community Server (GPL) Protocol version:10connection:localhost via UNIX socketserver characterset:utf8db characterset:utf8client characterset:utf8conn. Characterset:utf8unix socket:/tmp/mysql.sockuptime:15 min sec
Then modify php.ini (position is/etc/php.ini) No, copy a Php.ini.default
In:
Pdo_mysql.default_socket=/tmp/mysql.sockmysql.default_socket =/tmp/mysql.sockmysqli.default_socket =/tmp/ Mysql.sock
These three all modify well ~
And then
sudo apachectl stopsudo apachectl start
You can have it.
See Phpinfo () under the Mysql.sock is changed ~
MySQL Error-Modify Mysql.sock location