[Home]

Summary:ASTERISK-25813: res_config_mysql dbsock parameter
Reporter:Mc GRATH Ricardo (mcgrathr)Labels:
Date Opened:2016-02-25 15:43:51.000-0600Date Closed:2016-02-28 19:38:56.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Addons/app_mysql
Versions:13.1.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:I'm struggle with  mysql application, specifically dbsock parameter, it WARNING message connection; Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'.
weird issue Asterisk  invokes a  socket path connection no relationship to any logic configuration, strange whatever make parameters changes such as; dbname, dbuser, dbpass, on res_config_mysql.conf it seems it works, even if detect no database  found, Asterisk will use the default values.
But not happens with dbsock parameter, whatever set onto res_config_mysql.conf no meaning Asterisk it doesn't assume any condition and always use the path; '/var/lib/mysql/mysql.sock'.
The most strange point I couldn't  found any configuration file to change these default value.


Asterisk 13.1.0 built by root @ Asterisk-SoyoM on a i686 running Linux on 2015-01-16 20:52:42 UTC


res_config_mysql.conf
{noformat}
[general]
dbhost = localhost
dbname = asterisk
dbuser = myuser
dbpass = mypass
dbport = 3306
dbsock = =/var/run/mysqld/mysqld.sock
dbcharset = latin1
requirements=warn ; or createclose or createchar
{noformat}

extensions.conf
{noformat}
[bases]
exten => s,1,MYSQL(Connect connid localhost asterisk mypass credit utf8)
exten => s,2,MYSQL(Query resultid ${connid} SELECT username,credit FROM credit WHERE callerid=${CALLERIDNUM})
exten => s,3,MYSQL(Fetch fetchid ${resultid} datavar1 datavar2)
exten => s,4,GotoIf(${fetchid}?5:7)
exten => s,5,Festival("User ${datavar1} currently has credit balance of ${datavar2} dollars.")
exten => s,6,Goto(s,3)
exten => s,7,MYSQL(Clear ${resultid})
exten => s,8,MYSQL(Disconnect ${connid})
{noformat}

etc/my.conf
{noformat}
[mysqld]
datadir=/var/lib/mysql
bind-address =localhost
socket=/var/run/mysql/mysql.sock
skip-networking
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
host=localhost
socket=/var/run/mysql/mysql.sock
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2016-02-25 15:43:51.711-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2016-02-26 10:14:32.790-0600

The functionality you show is using app_mysql and not res_config_mysql. As a result the configuration for res_config_mysql would not be applicable to it. If so I don't believe the MYSQL application allows you to use a socket instead. Can you clarify your usage?

By: Mc GRATH Ricardo (mcgrathr) 2016-02-26 11:55:23.071-0600

Hi, thanks.
At first I'm just testing used dialplan to connect to mysql database engine running on the same asterisk system by using simple database.
Therefore I found when it use dialplan application MYSQL(connect etc. ..) it displayed;
app_mysql.c:381 aMYSQL_connect: mysql_real_connect(mysql,localhost,,dbpass,null,...) failed(2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

So I understood problems becomes from socket configuration, Asterisk couldn't find mysql.sock on '/var/lib/mysql/ path when mysql engine have installed on /var/run/mysql/ path.
Therefore I assumed dialplan MYSQL application configuration is management by res_config_mysql.conf as no find other file where could be assigned configuration path.
So my question how to correct Asterisk invoke of mysql.sock from '/var/lib/mysql/' to /var/run/mysql/  path?


By: Joshua C. Colp (jcolp) 2016-02-28 18:31:52.706-0600

This is not a bug. The app_mysql module does not support using a socket for connecting to MySQL. It only allows a hostname.

By: Mc GRATH Ricardo (mcgrathr) 2016-02-28 19:36:05.225-0600

Hi still have a question;

    Where should be configured on Asterisk to change mysql.sock from '/var/lib/mysql/' to /var/run/mysql/ path?

   app_mysql.c:381 aMYSQL_connect: mysql_real_connect(mysql,localhost,,dbpass,null,...) failed(2002): Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock' (2)


  No cleared information, found on other resources, tks.


By: Asterisk Team (asteriskteam) 2016-02-28 19:36:05.456-0600

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Joshua C. Colp (jcolp) 2016-02-28 19:38:57.029-0600

You would need to modify the app_mysql source code to specify a database socket. There is no configuration available to do this, as it is not implemented.