Home >Database >Mysql Tutorial >Can't connect to local MySQL server through socket &

Can't connect to local MySQL server through socket &

WBOY
WBOYOriginal
2016-06-07 15:15:421052browse

執行 PHP 時出現類似這樣的錯誤訊息: Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9 請將 /tmp/mysql.sock link 到 /var/lib/mysql 目錄裡即可

執行 PHP 時出現類似這樣的錯誤訊息:

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9

請將 /tmp/mysql.sock link 到 /var/lib/mysql 目錄裡即可:

linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn