Can’t establish connection to MySQL after PHP upgrade

Eneko
enekochan
Published in
1 min readDec 3, 2014

When you upgrade PHP there are chances that the new version is reading a different php.ini file than the previous version. You have to see which php.ini it's reading (for example with phpinfo()) and then check that it has correctly configured the pdo_mysql.default_socket, mysql.default_socket and mysqli.default_socket options. They are probably empty:

pdo_mysql.default_socket =
mysql.default_socket =
mysqli.default_socket =

And they should have something like this:

pdo_mysql.default_socket = /opt/local/var/run/mysql55/mysqld.sock
mysql.default_socket = /opt/local/var/run/mysql55/mysqld.sock
mysqli.default_socket = /opt/local/var/run/mysql55/mysqld.sock

--

--