{"id":1617,"date":"2013-03-22T15:33:06","date_gmt":"2013-03-22T07:33:06","guid":{"rendered":"https:\/\/sdeno.com\/?p=1617"},"modified":"2013-03-22T15:33:06","modified_gmt":"2013-03-22T07:33:06","slug":"cant-connect-to-local-mysql-server-through-socket-tmpmysql-sock-2%e5%86%b3%e8%a7%a3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=1617","title":{"rendered":"Can't connect to local MySQL server through socket '\/tmp\/mysql.sock' (2)\u51b3\u89e3\u529e\u6cd5"},"content":{"rendered":"<p>\u6458\u8981\uff1a\u89e3\u51b3\u4e0d\u80fd\u901a\u8fc7mysql .sock\u8fde\u63a5MySQL\u95ee\u9898 \u8fd9\u4e2a\u95ee\u9898\u4e3b\u8981\u63d0\u793a\u662f\uff0c\u4e0d\u80fd\u901a\u8fc7 &#8216;\/tmp\/mysql .sock&#8217;\u8fde\u5230\u670d\u52a1\u5668\uff0c\u800cphp\u6807\u51c6\u914d\u7f6e\u6b63\u662f\u7528\u8fc7&#8217;\/tmp\/mysql .sock&#8217;\uff0c\u4f46\u662f\u4e00\u4e9bmysql \u5b89\u88c5\u65b9\u6cd5 \u5c06 mysql .sock\u653e\u5728\/var\/lib\/mysql .sock\u6216\u8005\u5176\u4ed6\u7684\u4ec0\u4e48\u5730\u65b9\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\/etc\/my.cnf\u6587\u4ef6\u6765\u4fee\u6b63\u5b83\uff0c\u6253\u5f00\u6587\u4ef6\uff0c\u53ef\u4ee5\u770b\u5230\u5982\u4e0b\u7684\u4e1c\u4e1c\uff1a<br \/>\n[mysql d]<br \/>\nsocket=\/var\/lib\/mysql .sock<br \/>\n\u6539\u4e00\u4e0b\u5c31\u597d\u4e86\uff0c\u4f46\u4e5f\u4f1a\u5f15\u8d77\u5176\u4ed6\u7684\u95ee\u9898\uff0c\u5982mysql \u7a0b\u5e8f\u8fde\u4e0d\u4e0a\u4e86\uff0c\u518d\u52a0\u4e00\u70b9\uff1a<br \/>\n[mysql ]<br \/>\nsocket=\/tmp\/mysql .sock<br \/>\n\u6216\u8005\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539php.ini\u4e2d\u7684\u914d\u7f6e\u6765\u4f7fphp\u7528\u5176\u4ed6\u7684mysql .sock\u6765\u8fde\uff0c\u8fd9\u4e2a\u5927\u5bb6\u81ea\u5df1\u53bb\u627e\u627e<\/p>\n<p>\u6216\u8005\u7528\u8fd9\u6837\u7684\u65b9\u6cd5:<br \/>\nln -s \/var\/lib\/mysql \/mysql .sock \/tmp\/mysql .sock<br \/>\n\u6210\u529f\u4e86,\u5c31\u662f\u8fd9\u6837ln -s \/var\/lib\/mysql \/mysql .sock \/tmp\/mysql .sock<br \/>\nOK!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981\uff1a\u89e3\u51b3\u4e0d\u80fd\u901a\u8fc7mysql .sock\u8fde\u63a5MySQL\u95ee\u9898 \u8fd9\u4e2a\u95ee\u9898\u4e3b\u8981\u63d0\u793a\u662f\uff0c\u4e0d\u80fd\u901a\u8fc7 &#8216;\/tm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,9],"tags":[],"class_list":["post-1617","post","type-post","status-publish","format-standard","hentry","category-11","category-9"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/1617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1617"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/1617\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}