Failed to connect to MySQL in Asterisk real time

Hi,

Asterisk Version: 11.9
Ubuntu Server: 14.04

I installed MySQL, Asterisk and additional softwares. I am able to logging into Asterisk and res_config_mysql.so file is located in “/usr/lib/asterisk/modules” folder. Also, mysqld.sock file is also located in “/var/run/mysqld/mysqld.sock” folder.

When I enter “realtime mysql status” at CLI, it is giving the below message:

ERROR[11973]: res_config_mysql.c:1577 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on /var/run/mysqld/mysqld.sock (err 1045). Check debug for more info.

I am wondering about the problem. I don’t understand why it is not connecting, even though everything is installed and configured properly.

Any help would be appreciated.

Thanks in Advance.

Regards,
Mouli

Are You sure the credentials as well as the complete confuguration in res_config_mysql.conf is correct ?
What happens if You issue the following at the linux command prompt:

mysql -u -p

where , and are the values associated with the configuration options in res_config_mysql.conf.

Hi,

Thanks for your reply. I found the solution.

Solution:

I added the DB details in general section in top of the res_config_mysql.conf file and forgot to comment the [general] in the bottom of the res_config_mysql.conf file :smile:

So, it is ignoring the actual DB details which I have mentioned at the top of the file. Now, I commented out the bottom [general], and it is working fine now.

Thank you.

Regards,
Mouli.