could not connect to mysql

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

could not connect to mysql

Postby gattaba » Thu Dec 20, 2012 6:36 am

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
gattaba
 
Posts: 131
Joined: Thu Aug 02, 2012 6:04 am

Re: could not connect to mysql

Postby DomeDan » Thu Dec 20, 2012 8:07 am

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);
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Re: could not connect to mysql

Postby gattaba » Wed Dec 26, 2012 7:48 am

ok thanks
is it possible to install my application directly in VICIDIAL.
the application is in php / mysql
gattaba
 
Posts: 131
Joined: Thu Aug 02, 2012 6:04 am

Re: could not connect to mysql

Postby DomeDan » Thu Jan 03, 2013 4:48 am

I would not call it install, you can simply make a link to your php-file in the vicidial report page
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Re: could not connect to mysql

Postby williamconley » Thu Feb 21, 2013 6:24 pm

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.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 153 guests