I get asked this question at least 3-4 times a week. How do you fix this problem? Clearly, it’s causing your application to die or cause errors. Here’s the solution generic “catch-all” solution to fixing this problem if you don’t know where the configuration is.
There are two ways to fix this:
1. Link to the socket in the offending location. (This is the really ugly solution and I’m not going to even address it, because if you do this, you should be shot.)
2. Find the actual configuration file and modify it to point to the right unix socket. (The right solution and takes an extra 20-30 seconds).
First, you’re going to look for where the actual mysql socket is.
It can be named a series of things, but if it’s a reasonably sane installation, it’s going to have the strings “mysql” and “sock” in it.
so, issue the command (as root or as a user with access to the entire filesystem):
find / -name “mysql*sock”
It will traverse your filesystem and find the actual list anything that starts with “mysql” and ends with “sock”.
The other way to do it is to simply just look in your mysql configuration file. It’s usually called, “my.cnf”.
not the complete path and location to the file. (example: /var/run/mysql/mysql.sock)
Now, let’s go find the offending file on the application that defines the mysql socket location.
this time, we’re going to use the grep command.
You should run this command in the configuration file directory of your application (like /etc/asterisk) or (/usr/local/etc/myapplication).
If there are results, you will then edit those files and replace the value with the real fully qualified path of the mysql.sock file.
restart the application and you’re done.
If you’re still getting errors, find out what user the the application accessing the mysql database is using and verify the password. Modify the configuration appropriately and restart.
OK. You’re done. All should be well and life is good. You feel like buying my daughter a lollipop or something.. **chuckle**