Fault status: the php website fails to connect to mysql. However, you can use the mysql command in the command line to log on and operate normally. Solution: log on to mysql under the command line and run the following command: showvariableslikesocket. After the command is executed, the following echo will be obtained: Variable_namenbsp; nbsp; Valuesocketnbsp; nbsp; nb
Fault status: the php website fails to connect to mysql. However, you can use the mysql command in the command line to log on and operate normally. Solution: log on to mysql under the command line and run the following command: showvariableslikesocket. After the command is executed, the following echo will be obtained: Variable_namenbsp; nbsp; Value socketnbsp; nbsp; nb
Fault status: the php website fails to connect to mysql. However, you can use the mysql command in the command line to log on and operate normally.
Solution:
Log on to mysql under the command line and execute the following command:
Showvariableslikesocket;
After the command is executed, the echo is similar to the following:
Variable_namenbsp; nbsp; Value
Socketnbsp; nbsp;Homemysqldatamysqlsock
2. Edit phpini and find the mysqldefault_socket configuration item. The default value is generally a null value (use the sock path set during Mysql editing). Set the value of this item to the above echo.Homemysqldatamysqlsock:
; DefaultsocketnameforlocalMySQLconnectsnbsp; Ifemptyusesthebuiltin
; MySQLdefaults
Mysqldefault_socket = homemysqldatamysqlsock
3. Restart php.
Original article address: php fails to connect to mysql but the solution is normal through mysql Command. Thank you for sharing it with me.