Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Feb 15, 2019 10:16 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Wed Mar 06, 2013 2:56 am 
Offline

Joined: Sat Jan 21, 2012 1:33 am
Posts: 15
Location: Dhaka, Bangladesh
My System: RHEL 5.5
Cacti Version: 0.8.8a and 0.8.7g

After setup when I try to browse, an error shows: FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

Could anyone please help me regarding this.

Some Info related to my configuration:
Code:
groupadd cacti
useradd -g cacti cactiuser

MySQL configuration:
set password for [email protected]=password('*****');
create database cactidb;
grant all on cactidb.* to root;
grant all on cactidb.* to [email protected];
grant all on cactidb.* to cactiuser;
grant all on cactidb.* to [email protected];
use cactidb;
set password for [email protected]=password('*****');

And in include/config.php:
Code:
$database_type = "mysql";
$database_defaut = “cactidb”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “*****”;


With same configuration I have configured cacti one years ago. I can't understand why the error is showing. Please help me.


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Tue Mar 12, 2013 3:30 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22376
Location: Muenster, Germany
Please try to login via mysql from cli using same credentials
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Sat Mar 16, 2013 1:42 am 
Offline

Joined: Sat Jan 21, 2012 1:33 am
Posts: 15
Location: Dhaka, Bangladesh
Thanks gandalf,

Every think is OK now. There was a spelling mistake "default" on include/config.php ("$database_defaut). HA HA HA..I know its funny.

Thanks for your reply.


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Tue Jan 28, 2014 12:42 am 
Offline

Joined: Tue Jan 28, 2014 12:30 am
Posts: 1
1. Remove socket file:
[[email protected] ~]# rm /var/lib/mysql/mysql.sock
rm: remove socket `/var/lib/mysql/mysql.sock'? yes

2. Start MySQL service:
[[email protected]~]# service mysqld start
Starting mysqld: [ OK ]

Enjoy


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Thu Dec 25, 2014 10:31 pm 
Offline

Joined: Thu Dec 25, 2014 10:08 pm
Posts: 1
i removed the sql sock and restart the mysqld
but still same issue


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Thu May 21, 2015 1:52 am 
Offline

Joined: Thu May 21, 2015 1:45 am
Posts: 1
I faced the issue and troubleshoot to find out the issue was with mysql socket file. You need to specify the mysql.default_socket=/path/to/mysql.sock in php.ini and restart apache.
I did a posted my troubleshooting steps here -> http://goo.gl/n5fEqh


Top
 Profile  
 
 Post subject: Re: FATAL: Cannot connect to MySQL server on 'localhost'....
PostPosted: Fri Oct 28, 2016 10:04 am 
Offline

Joined: Fri Oct 28, 2016 9:58 am
Posts: 1
Don't use symbols [email protected] in cacti user password in MYSQL.
In my case, this call FATAL: Cannot connect to MySQL server on 'localhost' .


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group