https://blog.csdn.net/tornge/article/details/51388233
找到mysql sokcet的路径
1vim /etc/mysql/mysql.conf.d/mysqld.cnf 2 3socket = /var/run/mysqld/mysqld.sock
在php.ini中关于mysql的socket路径的地方,修改如如下
1[Pdo_mysql] 2; If mysqlnd is used: Number of cache slots for the internal result set cache 3; http://php.net/pdo_mysql.cache_size 4pdo_mysql.cache_size = 2000 5 6; Default socket name for local MySQL connects. If empty, uses the built-in 7; MySQL defaults. 8; http://php.net/pdo_mysql.default-socket 9pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock