Koozali.org: home of the SME Server

Cacti Install - Cannot connect to MySQL

Offline gregk

  • *
  • 5
  • +0/-0
Cacti Install - Cannot connect to MySQL
« on: September 14, 2010, 08:11:41 PM »
I installed rrdtool and cacti on our SME Server (7.5.1), but cannot get the login from the browser. I installed the programs following the directions here: http://wiki.contribs.org/Cacti , but have when I try to login with the browser from a client machine on the network, https://sm1.slbc.local/cacti, I get the following:

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

Doing a search on config.php, I found two relevant places:
/etc/e-smith/templates/opt/cacti/include/config.php/config.php
/opt/cacti/include/config.php

In the second one, which seemed to be the most likely one that was being referred to in the error message, I have the following:

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti_sme";
$database_hostname = "localhost";
$database_username = "root";
$database_password =  [long password here - removed for security]
$database_port = "3306";

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

Any suggestions as to how to get Cacti to run would be much appreciated.

-Greg

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Cacti Install - Cannot connect to MySQL
« Reply #1 on: September 15, 2010, 07:33:20 AM »
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti_sme";
$database_hostname = "localhost";
$database_username = "root";
$database_password =  [long password here - removed for security]
$database_port = "3306";
Never, and I mean never ever, use the root user for applications to access the database, this is a huge security risk. The root user has far too much privileges. Please read up on how to create a separate user (http://wiki.contribs.org/MySQL) after fixing your MySQL server as MySQL should just run. Is this perhaps the same system as in bug 6201? If so I suggest you first fix your server as you seem to have some serious issues.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline gregk

  • *
  • 5
  • +0/-0
Re: Cacti Install - Cannot connect to MySQL
« Reply #2 on: September 15, 2010, 11:13:17 AM »
Cactus,

Thank you for the reply. However, I don't know what you mean by "fix your server", since this is a brand new install, as in last week. The only addons we have made to the system are rrdtool and cacti. So, "fixing" it would imply that we broke something. I would suggest that either the installation iso is faulty, or there are some instructions for post-install that I have not seen and would be most appreciative if someone could direct me there.

We are using SME server because it is an easy to install and easy to administer, as well as highly secure system. However, the lack of a built-in network monitoring system is a problem for us, and we need a monitoring tool. Therefore we need to install Cacti as an add-on. It would be helpful for SME newbies to have clear and detailed instructions for such installations.

You state, "Never, and I mean never ever, use the root user for applications to access the database, this is a huge security risk." Again, this was a standard install following the instructions from http://wiki.contribs.org/Cacti. If there is something else that we need to do, some clear instructions would be helpful.

I'll create a new user for MySQL with a decent password for Cacti to use, following the instructions on the link you provided.

We are setting up this server at the new public broadcasting service in Sierra Leone (West Africa).

Greg

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Cacti Install - Cannot connect to MySQL
« Reply #3 on: September 15, 2010, 11:26:27 AM »
Thank you for the reply. However, I don't know what you mean by "fix your server", since this is a brand new install, as in last week. The only addons we have made to the system are rrdtool and cacti. So, "fixing" it would imply that we broke something. I would suggest that either the installation iso is faulty, or there are some instructions for post-install that I have not seen and would be most appreciative if someone could direct me there.
Yes, that most likely is the case as I have instaleld many SME Servers and have never had the issue, as well as lots of other users not reporting the issue leads me to believe the issue is not in the general product but in your setup.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline gregk

  • *
  • 5
  • +0/-0
Re: Cacti Install - Cannot connect to MySQL
« Reply #4 on: September 15, 2010, 11:33:56 AM »
We have no data on the system yet, although we have created users, groups and iBays. Would you suggest we do a complete re-install?

Offline gippsweb

  • *****
  • 232
  • +0/-0
    • Wots I.T.?
Re: Cacti Install - Cannot connect to MySQL
« Reply #5 on: September 15, 2010, 11:39:17 AM »
Using the wiki to install rrd tool and cacti, I've never had a problem with installing cacti or rrdtool. The issue you are seeing may ossur if you are installing cacti directly from the cacti site though...

The only issues I've had is upgrading cacti to more recent versions, 0.8.7b seems to be the most recent version of cacti I can get working. Later versions seem to require later versions of php than are installed with SME 7.5.1.

I am yet to try SME8 beta, it should run the most recent version of cacti. Although this is only a problem if you are trying to run templates that were created in more recent versions anyway...