MySQL connection fails - duplicate ports, tcp for socket

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
petteyg359
Posts: 3
Joined: Thu Dec 30, 2010 6:24 pm

MySQL connection fails - duplicate ports, tcp for socket

Post by petteyg359 »

Freshly downloaded 0.8.7g, extracted it, changed nothing but settings.php for database config. PHP version is 5.3.4. I would like to use a socket to connect to the database, but not only is there no option for that, the TCP connection is impossible.

Something adds 3306, regardless of $database_port's setting. If I set it empty, or to 3306, or comment it out, I get 3306:3306 in the connection string. If I set it to anything else, I get anything else:3306 as the connection string.

Code: Select all

( ! ) Warning: mysqli_real_connect() [function.mysqli-real-connect]: [2002] Connection refused (trying to connect via tcp://localhost:3306:3306) in /home/cacti/cacti/lib/adodb/drivers/adodb-mysqli.inc.php on line 83
Call Stack
#	Time	Memory	Function	Location
1	0.0001	639584	{main}( )	../index.php:0
2	0.0003	670168	include( '/home/petteyg/cacti.foldspace.org/include/auth.php' )	../index.php:25
3	0.0007	743056	include( '/home/petteyg/cacti.foldspace.org/include/global.php' )	../auth.php:25
4	0.0195	3709064	db_connect_real( )	../global.php:197
5	0.0213	4082040	ADOConnection->PConnect( )	../database.php:48
6	0.0213	4082088	ADODB_mysqli->_pconnect( )	../adodb.inc.php:470
7	0.0213	4082136	ADODB_mysqli->_connect( )	../adodb-mysqli.inc.php:101
8	0.0214	4084488	mysqli_real_connect ( )	../adodb-mysqli.inc.php:83
Last edited by petteyg359 on Mon Jan 03, 2011 6:38 pm, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by gandalf »

petteyg359 wrote:Freshly downloaded 0.8.7g, extracted it, changed nothing but settings.php for database config.
This should be include/config.php.
And yes, we use the default of 3306 e.g. in include/global.php in case that config.php was not found (some distros put it in a different location). I never heard about socket support for mysql in cacti. So I suspect it will not work, at least not without some testing and perhaps development work.
Contributions to this are welcome
R.
petteyg359
Posts: 3
Joined: Thu Dec 30, 2010 6:24 pm

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by petteyg359 »

Yeah, meant config.php. Not going to turn on MySQL networking just for Cacti, though.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by gandalf »

So do you have any experience in using/implementing socket support?
R.
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by TheWitness »

This makes no sense. Can you please post your config.php (sans passwords).

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by Linegod »

My test box has run without network support (skip-networking) for at least a year. No issues.

Code: Select all

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "087svn";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "xxxxxxxxxxxxxxxxxxxx";
$database_port = "3306";

/* Default session name - Session name must contain alpha characters */
#$cacti_session_name = "Cacti";

--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
petteyg359
Posts: 3
Joined: Thu Dec 30, 2010 6:24 pm

Re: MySQL connection fails - duplicate ports, tcp for socket

Post by petteyg359 »

Code: Select all

$database_type = "mysqli";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "password";
$database_port = "";
If 3306 is in the config.php, I get the second 3306 as in my first post.

Code: Select all

( ! ) Warning: mysqli_real_connect() [function.mysqli-real-connect]: [2002] Connection refused (trying to connect via tcp://localhost::3306) in /home/petteyg/cacti.foldspace.org/lib/adodb/drivers/adodb-mysqli.inc.php on line 83
Call Stack
#	Time	Memory	Function	Location
1	0.0001	640848	{main}( )	../index.php:0
2	0.0004	671432	include( '/home/petteyg/cacti.foldspace.org/include/auth.php' )	../index.php:25
3	0.0007	744320	include( '/home/petteyg/cacti.foldspace.org/include/global.php' )	../auth.php:25
4	0.0197	3710072	db_connect_real( )	../global.php:197
5	0.0214	4083064	ADOConnection->PConnect( )	../database.php:48
6	0.0214	4083112	ADODB_mysqli->_pconnect( )	../adodb.inc.php:470
7	0.0214	4083160	ADODB_mysqli->_connect( )	../adodb-mysqli.inc.php:101
8	0.0214	4085512	mysqli_real_connect ( )	../adodb-mysqli.inc.php:83
Dump $_SERVER
Dump $_GET
Dump $_POST
Dump $_COOKIE
Dump $_FILES
Dump $_ENV
Dump $_SESSION
Dump $_REQUEST
gandalf wrote:So do you have any experience in using/implementing socket support?
R.
Yeah. Use a database layer that isn't insane :) However, ADO is PHP, and PHP itself has no problems with mysql(i) and socket connections, so I'm not sure where the problem actually is.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests