can't connect local MySql Server though socket "/tmp"如何解決

來源:互聯網
上載者:User

標籤:

openwrt上安裝php,提示如此

網上一大通找

發現的都是can‘t connect local MySql Server though socket "/tmp/mysql.socket"如何解決

人家還是找的mysql.socket;我的竟然直接找的tmp目錄,真是無語。人家的解決方案使用軟串連直接無效;

 

難道要我自己編譯php嗎?想想都頭大。

 

繼續找方案:

在此文檔中

http://kong1616.iteye.com/blog/682342

發現了這麼一句話

在/etc/php.ini修改mysql.default_socket的值,在這個檔案中,關於mysql.default_socket的值的說明是這樣的, 
; Default socket name for local MySQL connects.  If empty, uses the built-in MySQL defaults. 
這個值一開始是空的,也就是說,如果我們不主動去修改的話,php將會使用內建在mysql中的預設值 

真是救命稻草,我的php程式用的mysqli,而php.ini中配置的都是mysql,所以,php.ini加上如下內容,順利解決問題:

 

[MYSQLI]mysqli.allow_local_infile = On mysqli.allow_persistent = On mysqli.cache_size = 2000 mysqli.max_persistent = -1 mysqli.max_links = -1 mysqli.default_port =3306 mysqli.default_socket =/tmp/mysql.sock mysqli.default_host =127.0.0.1 mysqli.default_user =root mysqli.default_password =19870215 mysqli.connect_timeout = 60 mysqli.trace_mode = Off

 

can't connect local MySql Server though socket "/tmp"如何解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.