Need help, I almost have Cacti installed

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

Moderators: Developers, Moderators

williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Need help, I almost have Cacti installed

Post by williams1075 »

I am almost done doing my first install of cacti. I installed on Fedora 4 and I learned a lot along the way. I've come to a roadblock though, and I can't seem to get around it.

When I go to //hostname/cacti I get this error message.

Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.

I know the database is there, and I can connect manually with the userid and pass that I have configured in the config.php file. I think I have file permissions right.

Has anyone else ran into this problem, and if so could you point me the right way? Thanks for any help in advance.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Have you edited include/config.php to reflect the database/username/password?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

yes,
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Switch to the web user, "su - <webuser>" and then try to access mysql. What happens?

Anything in the error log for apache that would give you a clue?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

as long as I specify the user and the password in the command line to start the db then it works fine.

/usr/local/mysql/bin/mysql cactidb --user=cactiuser --password=cactipw


if I try it without specifying a username than for some reason it tries to connect using another username.
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

I get this error in the apache error_log

[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339


if I do a locate on mysql.sock I don't come up with any results. I don't understand what is going on. If I can connnect manually to the database then the database should be fine? right? I was really thinking that this was probably a permissions issue.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Did you install php from packages or from source?

Does '/var/lib/mysql/mysql.sock' exist? Does '/tmp/mysql.sock' exist?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

I installed from the source.

mysql.sock does exist in /temp
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

updated error.log info from apache. this is the entire error, reflecting the request from the web server:

[client 10.150.0.6] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/lib/php/session/sess_n9gi1lpe4p66umlco75llc9jd4, O_RDWR) failed: Permission denied (13) in /www/htdocs/cacti/include/config.php on line 89
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 339
[client 10.150.0.6] PHP Warning: Unknown: open(/var/lib/php/session/sess_n9gi1lpe4p66umlco75llc9jd4, O_RDWR) failed: Permission denied (13) in Unknown on line 0
[client 10.150.0.6] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
[Mon Sep 26 15:05:07 2005] [error] [client 10.150.0.6] File does not exist: /www/htdocs/favicon.ico

thanks everyone... sorry this is so long, but I thought it would be useful.
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

williams1075 wrote: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
It's looking for mysql.sock in /var/lib/mysql, but your compiled version places it in /tmp

Change '/etc/my.cnf' so that:

socket=/tmp/mysql.sock

is instead

socket=/var/lib/mysql/mysql.sock

Then restart mysql

Note: If you don't have a '/etc/my.cnf', you should have my-small.cnf, my-large.cnf, etc. Copy one of those to '/etc/my.cnf', make the changes and restart mysql.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

Are you running a distribution of Linux that uses SELinux?
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

I checked the my.cnf file and it was correct:

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]


Here is the directory /tmp file listing

root@monitor tmp]# ls -l
total 80
drwx------ 3 jwillia2 jwillia2 4096 Sep 27 10:23 gconfd-jwillia2
drwx------ 2 root root 4096 Sep 26 07:49 gconfd-root
drwx------ 2 jwillia2 jwillia2 4096 Sep 27 10:23 keyring-S3XV8d
srwxrwxr-x 1 jwillia2 jwillia2 0 Sep 27 10:23 mapping-jwillia2
srwxrwxrwx 1 mysql mysql 0 Sep 27 10:23 mysql.sock
drwx------ 2 jwillia2 jwillia2 4096 Sep 27 10:24 orbit-jwillia2
drwx------ 2 jwillia2 jwillia2 4096 Sep 27 10:23 ssh-dRYEBx2532
drwx------ 2 jwillia2 jwillia2 4096 Sep 27 10:28 ssh-IJyltU2798
drwx------ 2 root root 4096 Sep 23 13:42 texconfig.Px4688
drwx------ 2 root root 4096 Sep 23 13:37 tmp.aFoUMt2407
-rw------- 1 jwillia2 jwillia2 2679 Sep 27 10:26 xses-jwillia2.1Jt5ZZ

thanks for all the suggestions guys.
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

elnino wrote:Are you running a distribution of Linux that uses SELinux?
I don't know.... I know it is Fedora Core 4.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

FC4 does use SELinux, check out http://forums.cacti.net/viewtopic.php?t=7759 for more information.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
williams1075
Posts: 27
Joined: Mon Sep 26, 2005 1:10 pm
Location: williamsport, pa

Post by williams1075 »

No good I disabled SELinux, and no good. I really think that I just got something wrong in the install. This is not a production box, so I think I might just try a reinstall. I will follow the directions that I got from your site again, and be more carefull this time.

Thanks for your help with this issue.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests