How to change socket pdo_mysql uses?

I have a jQuery plugin (dataTables) that I’m trying to turn into a WordPress plugin, but the issue I’m running into is that WordPress uses a different socket for mysql (mysqld.sock) than what the plugin is expecting (mysql.sock). The plugin throws this error when being used:

SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through
socket ‘/var/lib/mysql/mysql.sock’ (2)

Read More

Would changing the socket pdo_mysql uses to mysqld.sock fix this issue? If so, how would I go about changing the socket pdo_mysql uses?

I created a phpinfo.php file and this is what it returned:

mysql:

mysql._defaultsocket: /var/run/mysqld/mysqld.sock (this file and directory exist)

pdo_mysql:

pdo_mysql.default_socket: /var/lib/mysql/mysql.sock (this file and directory do not exist)

Related posts

Leave a Reply