解決不能透過mysql.sock連線MySQL問題的辦法(轉)
解決不能透過mysql.sock連線MySQL問題的辦法(轉)[@more@]這個問題主要提示是,不能透過'/tmp/mysql.sock'連到伺服器,而php標準配置正是用過'/tmp/mysql.sock',但是一些mysql安裝方法將mysql.sock放在/var/lib/mysql.sock或者其他的什麼地方,你可以透過修改/etc/my.cnf檔案來修正它,開啟檔案,可以看到如下的東東:
[mysqld]
socket=/var/lib/mysql.sock
改一下就好了,但也會引起其他的問題,如mysql程式連不上了,再加一點:
[mysql]
socket=/tmp/mysql.sock
或者還可以透過修改php.ini中的配置來使php用其他的mysql.sock來連,這個大家自己去找找
或者用這樣的方法:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
還有:
phpmyadmin的說明書有說
The error message "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)..." is displayed. What can I do?
For RedHat users, Harald Legner suggests this on the mailing list:
On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line
mysql.default_socket = /tmp/mysql.sock
change it to
mysql.default_socket = /var/lib/mysql/mysql.sock
Then restart apache and it will work.
Here is a fix suggested by Brad Ummer in the phpwizard forum:
First, you need to determine what socket is being used by MySQL.
To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin. Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example).
Then, you need to tell PHP to use this socket.
Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.
For example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
[mysqld]
socket=/var/lib/mysql.sock
改一下就好了,但也會引起其他的問題,如mysql程式連不上了,再加一點:
[mysql]
socket=/tmp/mysql.sock
或者還可以透過修改php.ini中的配置來使php用其他的mysql.sock來連,這個大家自己去找找
或者用這樣的方法:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
還有:
phpmyadmin的說明書有說
The error message "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)..." is displayed. What can I do?
For RedHat users, Harald Legner suggests this on the mailing list:
On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line
mysql.default_socket = /tmp/mysql.sock
change it to
mysql.default_socket = /var/lib/mysql/mysql.sock
Then restart apache and it will work.
Here is a fix suggested by Brad Ummer in the phpwizard forum:
First, you need to determine what socket is being used by MySQL.
To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin. Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example).
Then, you need to tell PHP to use this socket.
Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.
For example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617731/viewspace-961895/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 解決mysql不能遠端連線的問題MySql
- MySQL sleep連線過多 解決辦法MySql
- 解決jdbc不能重連mysql的問題JDBCMySql
- Windows無法配置此無線連線這個問題的解決辦法Windows
- Xshell連線Linux慢問題解決辦法Linux
- 11gR2不能在client段通過scanip連線的解決辦法client
- 遠端桌面不能全屏問題解決辦法
- Mysql出現連線錯誤解決辦法MySql
- mysql資料庫連線過多的錯誤,可能的原因分析及解決辦法(轉)MySql資料庫
- Mysql安裝過程中遇到的問題及解決辦法MySql
- VPN連線800錯誤的解決辦法(轉)
- mysql 語句不能update的解決辦法MySql
- 連線sql server時,不能使用127.0.0.1的解決辦法SQLServer127.0.0.1
- MySQL不能從外部 連線的解決方法MySql
- MySQL複製過程中出現的從庫無法連線主庫的解決辦法MySql
- IOS下圖片不能顯示問題的解決辦法iOS
- xshell遠端連線自動斷開的問題解決辦法
- Java連線虛擬機器的redis報錯問題解決辦法Java虛擬機Redis
- Mysql實現全外部連線(mysql無法使用full join的解決辦法)MySql
- SSH 連線卡頓解決辦法
- windows無法配置此無線連線的解決辦法Windows
- MySQL不能從外部連線?速看解決MySql
- MYSQL++ 資料庫連線超時的解決辦法LTMySql資料庫
- Mac出現WiFi連線問題怎麼辦 Mac WiFi連線問題解決方法MacWiFi
- 連線oracle錯誤解決辦法Oracle
- linux centos7 mysql無法遠端連線解決辦法LinuxCentOSMySql
- 解決macOS vim 不能連按問題Mac
- 找不到寬頻連線的解決辦法
- 【slam】解決ubuntu無法透過拼音輸入中文的問題SLAMUbuntu
- 安裝DBD:MySql模組遇到的問題及解決辦法MySql
- 你遇到過的相容性問題以及解決辦法
- Navicat Premium_11不能連線oracle11g的解決辦法(ORA-28547)REMOracle
- vnc連線黑屏,3步解析vnc連線黑屏的解決辦法VNC
- 透過Amoeba連線mysql報錯MySql
- 跨域問題解決辦法跨域
- mysql 匯入問題:Unknown command '\'' 解決辦法MySql
- IE 瀏覽器被迫連線某網站的解決辦法(轉)瀏覽器網站
- VMware中解決ubuntu不能連線網路問題。(親測有效)Ubuntu