Im connecting to mysql database with server defined as localhost:/some/path/ms.sock, can anyone explain how does this works? It surely is a path since localhost:/some/../some/path/ms.sock works as well, but when i run this exec from php

mysqldump -h localhost:/some/path/ms.sock -u xxx -pxxx xxx

it writes Error: 2005: Unknown MySQL server host 'localhost:/some/path/ms.sock' The PHP script is in the same directory. However this works fine:

new mysqli("localhost:/some/path/ms.sock", "xxx", "xxx", "xxx");
有帮助吗?

解决方案

The /some/path/ms.sock refers to the Unix domain socket through wich PHP will connect to MySQL (this is one of the three connection protocols supported by MySQL, besides the usual TCP/IP).

This path must be provided to the mysql* clients with the --socket (or -S) option:

mysqldump -h localhost -S /some/path/ms.sock -u ...
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top