FATAL: Connection to Cacti database failed

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

Moderators: Developers, Moderators

Post Reply
Natarajan
Posts: 3
Joined: Thu Aug 27, 2020 10:57 pm

FATAL: Connection to Cacti database failed

Post by Natarajan »

After i installed cacti on my centos 7 machine im not getting cacti webpage.

Error i got listed as follows,

FATAL: Connection to Cacti database failed. Please ensure:

the PHP MySQL module is installed and enabled.
the database is running.
the credentials in config.php are valid.

referred documents : https://www.tecmint.com/install-cacti-n ... os-fedora/

checked configs bit by bit and searched about this errors on google also didnt help.

I resetted my machine and installed cacti still im getting same errors please help me out.
Natarajan
Posts: 3
Joined: Thu Aug 27, 2020 10:57 pm

Re: FATAL: Connection to Cacti database failed

Post by Natarajan »

No replies from cacti team till now.

Mysql is running .
config.php is configured perfectly.
php mysql modules is installed and enabled.

but still im getting this error.

Verified cacti docs and other bloggers docs nothing helped me to resolve this issue.!!
tertius
Cacti User
Posts: 82
Joined: Wed Mar 01, 2017 2:34 pm

Re: FATAL: Connection to Cacti database failed

Post by tertius »

Firewall open?
Mysql server actually running?
Configured mysql server to use tcp/ip socket and not unix socket only?
Created mysql user that is allowed to connect from the cacti machine?
Allowed the httpd daemon to create tcp/ip connections with selinux? (setsebool)
bmfmancini
Cacti User
Posts: 250
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: FATAL: Connection to Cacti database failed

Post by bmfmancini »

What version of PHP ?
What version of Cacti ?

What is the status of SELINUX ?

Try this simeple php script to see if php can connect to the db

Code: Select all

 <?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
Telecom Lifer, Monitoring and performance enthusiast, Father, Husband

Cacti Bug Hunter and Member

www.seanmancini.com
sean(at)seanmancini.com
github.com/bmfmancini

My Cacti scripts and templates ( Non official)
Cacti install wizard https://github.com/bmfmancini/cacti-install-wizard
Cacti templates https://github.com/bmfmancini/Cacti-templates

Always willing to help!
Achea9
Posts: 44
Joined: Mon Sep 07, 2020 3:07 am

Re: FATAL: Connection to Cacti database failed

Post by Achea9 »

Hi,

try to change the "localhost" to 127.0.0.1 in cacti and check.
If that doesn't help remove MARIADB, make sure you use from a proper Repository for MARIADB and reinstall, make sure to mysql_secure_installation to set root password and create cacti under mysql and go ahead with installation process. Good Luck:-)
Natarajan
Posts: 3
Joined: Thu Aug 27, 2020 10:57 pm

Re: FATAL: Connection to Cacti database failed

Post by Natarajan »

everything is perfect, but still im not getting cacti webpage.

finally uninstalled cacti db and installed PRTG.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest