0

Currently I am setting up a server to run a web site built on Symfony framework (1.4 version). After tuning Apache2 to work with needed folders, and setting proper permissions on every chunk of path required (755 for folders, 644 for files), PHP is not connecting with MySQL.

Full error log looks like this:

PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

Index (13) of the error suggests permissions failing, but socket permissions look like this:

srw-r--r-- 1 mysql mysql 0 May 31 19:58 /var/run/mysqld/mysqld.sock

I tried what I found in other questions, but nothing worked yet.

I am using Ubuntu 12.04.

sebix
  • 4,313
  • 2
  • 29
  • 47
Jared Rox
  • 101
  • 6
  • Note that a fresh install of Ubuntu 12.04 and a Mysql install from repository, the default permissions for sock file are : `srwxrwxrwx 1 mysql mysql 0 Jun 13 18:00 /var/run/mysqld/mysqld.sock`. Mysql user and group should have full permissions on the sock file... – krisFR Jun 13 '15 at 16:05
  • Thanks! You are right, permissions were wrong. This just move my problem to the `PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)` category. – Jared Rox Jun 13 '15 at 17:21
  • Did you restart `mysql` ? – krisFR Jun 13 '15 at 18:05
  • Yes, now the problem seems to be that `mysql` won't start. In the error log I find `[ERROR] Fatal error: Can't open and lock privilege tables: Table 'host' is read only` – Jared Rox Jun 13 '15 at 18:25
  • In the end it was all about permissions. Problem solved now, thanks for answering :). – Jared Rox Jun 14 '15 at 12:04

0 Answers0