1

I followed all the install wizards When setting up icinga2, I have the following error:

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

I tried using the mysql command line utility, and I got the same response. To fix this, I symlinked the socket such that ls -alF shows the following:

lrwxrwxrwx 1 mysql mysql 25 Jun  2 10:23 /var/run/mysqld/mysqld.sock -> /var/lib/mysql/mysql.sock=

and ls -alF /var/lib/mysql/mysql.sock returns

srwxrwxrwx 1 mysql mysql 0 Jun  2 10:39 /var/lib/mysql/mysql.sock=

Now the mysql command line works without complaint, but I continue to receive "Can't connect" errors from the icinga2 web interface. I cannot find anywhere in the logs that shows any errors. I've checked the following log files:

ido2db.debug (does some stuff and then cleans up child processes)
apache2/error.log (nothing)
apache2/access.log (shows requests coming through from web interface)
icinga2.err (nothing)
icinga2/startup.log (looks pretty standard)

There do not appear to be any logs that are specific to the icinga2 web interface (there's no /var/log/icingaweb2, and there's no web log in /var/log/icinga2)

I do not want to change the mycnf file because I have many other services relying on the current location of the mysql socket.

How do I solve this problem? I can't seem to find a config that I can modify for icinga2 to point it at a different socket. Can I set up mysql to have 2 sockets?

If I change the my.cnf file to set the socket in the correct location, everything works.

0

The directory /var/lib/mysql is usually only readable my the users mysql and of course root.

So any other user, like nagios, icinga or Apache's system user won't be able to access the socket.

| improve this answer | |
  • But it works when I change the location of the socket in my.cnf, and that socket is also owned by mysql? – Peter Klipfel Jun 3 '15 at 19:00
  • What OS is that? – lazyfrosch Jun 3 '15 at 19:12
  • I'm running this on Ubuntu 14.04 – Peter Klipfel Jun 3 '15 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.