Actualy my server updated PHP to 5.3.6 from 5.2.x. After this- all my mysql connections failed. I catch such PDO error Connection failed: SQLSTATE[HY000] [2002] No such file or directory Also checked in php.ini file value of the pdo_mysql.default_socket which is /tmp/mysql.sock
Host service told me to repair my mysql DB passwords. But it didn't help. Can somebody help me with this issue?
hehe, nice support ;) This has absolutely nothing to do with the passwords. PDO_MySQL communicates under linux via sockets with the mysql-server. First of all find out, where is the socket now. (Sorry, but I dont know how :X)
If you have access to the php.ini
, change
pdo_mysql.default_socket = /path/to/mysql.sock
If you dont have access to it, change the the instanciation of the pdo-object like described under PDO_MySQL Connection
$db = new PDO('mysql:unix_socket=/path/to/mysql.sock;dbname=testdb');
You probably must change/add some settings here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.