欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Can't connect to local MySQL server through socket &

程序员文章站 2022-06-15 14:45:38
...

執行 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