Page 1 of 1
could not connect to mysql
Posted:
Thu Dec 20, 2012 6:36 am
by gattaba
hello,
I have a small aplication in php to export the contents of the table vicidial_list. But I can not connect to the server has mysql VICIDIAL even though I created a user.
it must change some parameter on mysql?
Goautodial 2.0
Vicidial
VERSION: 2.2.1-237
BUILD: 100510-2015
Asterisk-1.4.27.1-1
Vtiger version 5.1.0
Centos 6.3
digium card : TE122
Re: could not connect to mysql
Posted:
Thu Dec 20, 2012 8:07 am
by DomeDan
You can use the vicidial/dbconnect.php file like all vicidial-reports does:
- Code: Select all
require("dbconnect.php");
then you can use $link to query your database, like this:
- Code: Select all
$stmt = "SELECT count(*) from vicidial_list;";
$rslt=mysql_query($stmt, $link);
Re: could not connect to mysql
Posted:
Wed Dec 26, 2012 7:48 am
by gattaba
ok thanks
is it possible to install my application directly in VICIDIAL.
the application is in php / mysql
Re: could not connect to mysql
Posted:
Thu Jan 03, 2013 4:48 am
by DomeDan
I would not call it install, you can simply make a link to your php-file in the vicidial report page
Re: could not connect to mysql
Posted:
Thu Feb 21, 2013 6:24 pm
by williamconley
if you cannot connect, it is usually because the user does not have permission to connect from that location. of course, bad user or pass is also quite possible, but most support calls on this topic result in "127.0.0.1" vs "localhost" vs an actual IP address.
A good test is to attempt the same credentials using the command line:
mysql asterisk -u MYSQLUSERNAME -pPASSWORD
Note that there is no space between -p and PASSWORD in this implementation.
if this fails, then your user does not have permission to log in from localhost which is required for php to log in with the same method.
Another method is to call the vicidial dbconnect.php above (from DomeDan) which loads the database variable "$link" and then uses it to fire off a query. After that you will need to "do something" with the results. There are many sample of how to view the results in all the various vicidial ".php" files.
However, if you'd like I can post a "sample" derived from using DomeDan's solution. We do it all the time to piggyback existing Vicidial code to generate new functionality.