Cannot connect to MySQL server on 'localhost'. Please..
Moderators: Developers, Moderators
Cannot connect to MySQL server on 'localhost'. Please..
Any ideas ? Password is set in config.php, web interface is OK.. This report int the subject of this topic is from log...
THX.
THX.
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Do you have this error message when running the Cacti poller ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
This is generated by CMDPHP...fmangeant wrote:Do you have this error message when running the Cacti poller ?
And I can see another yet message in the log:
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[10] WARNING: Result from CMD not valid. Partial Result: 1min: 5min: 10
The graphs are generated, but theirs contains is blank, with no data...
Last edited by karliak on Thu Apr 06, 2006 8:01 am, edited 1 time in total.
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
You mean "php poller.php" ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
I think that the problem is about collecting data, isn't it ?:fmangeant wrote:You mean "php poller.php" ?
04/06/2006 02:23:01 PM - CMDPHP: Poller[0] Host[1] DS[14] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get used /dev/sda5, output: 64593648
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[14] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get available /dev/sda5, output: 2001688
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[13] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get used /dev/sda3, output: 8941936
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[13] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get available /dev/sda3, output: 1548168
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[12] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get used /dev/sda1, output: 19343
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[12] CMD: perl /srv/www/htdocs/private/cacti/scripts/query_unix_partitions.pl get available /dev/sda1, output: 17507
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[11] CMD: perl /srv/www/htdocs/private/cacti/scripts/loadavg_multi.pl, output: U
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[11] WARNING: Result from CMD not valid. Partial Result: 1min: 5min: 10
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[10] CMD: perl /srv/www/htdocs/private/cacti/scripts/loadavg_multi.pl, output: U
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[10] WARNING: Result from CMD not valid. Partial Result: 1min: 5min: 10
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[9] CMD: perl /srv/www/htdocs/private/cacti/scripts/linux_memory.pl SwapFree:, output: 813196
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[8] CMD: perl /srv/www/htdocs/private/cacti/scripts/linux_memory.pl MemFree:, output: 55368
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[7] CMD: perl /srv/www/htdocs/private/cacti/scripts/unix_processes.pl, output: 163
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[6] CMD: perl /srv/www/htdocs/private/cacti/scripts/unix_users.pl, output: 14
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[5] CMD: perl /srv/www/htdocs/private/cacti/scripts/loadavg_multi.pl, output: U
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[5] WARNING: Result from CMD not valid. Partial Result: 1min: 5min: 10
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[4] CMD: perl /srv/www/htdocs/private/cacti/scripts/linux_memory.pl SwapFree:, output: 813196
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /srv/www/htdocs/private/cacti/scripts/linux_memory.pl MemFree:, output: 56236
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] Host[1] SNMP: Host responded to SNMP
04/06/2006 02:23:00 PM - CMDPHP: Poller[0] PHP Script Server Started Properly
04/06/2006 02:23:00 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is cmd
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
What poller are you running ? cactid or cmd.php ?
And also, can you post the versions you're using ?
And also, can you post the versions you're using ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Can you run the poller in DEBUG mode once, and post the result ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
OK, I switched it to "cactid", debug mode...fmangeant wrote:Can you run the poller in DEBUG mode once, and post the result ?
I get this data int the log :
04/06/2006 07:00:03 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
04/06/2006 06:55:03 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
04/06/2006 06:50:04 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
04/06/2006 06:45:03 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
04/06/2006 06:42:20 PM - SYSTEM STATS: Time: 1.0998 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2, Data Sources 5, RRDs Processed 5
04/06/2006 06:42:20 PM - CMDPHP: Poller[0] Time: 0.4835 s, Theads: N/A, Hosts: 1
04/06/2006 06:42:20 PM - CMDPHP: Poller[0] Host[1] DS[7] CMD: perl /srv/www/htdocs/private/admin/cacti/scripts/unix_processes.pl, output: 129
04/06/2006 06:42:20 PM - CMDPHP: Poller[0] Host[1] DS[6] CMD: perl /srv/www/htdocs/private/admin/cacti/scripts/unix_users.pl, output: 2
database server is running, database cacti and relevant exists, I could connect via "cacti" user to cacti database:
mysql -u cacti -p cacti
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 294 to server version: 4.1.13
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use cacti
Database changed
mysql> show databases;
+----------+
| Database |
+----------+
| cacti |
| mysql |
| snort |
| test |
| tmp |
+----------+
5 rows in set (0.00 sec)
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Do you have a cactid.conf in the same directory as the cactid binary ?karliak wrote:I get this data int the log :
04/06/2006 07:00:03 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
Also, can you post your cactid.conf and include/config.php ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
OK, problem was in the copying /usr/share/cacti/ to /srv/www/htdocs/ and configuring overthere. I changed database configuration in /usr/share/..... and the error is solved.fmangeant wrote:Do you have a cactid.conf in the same directory as the cactid binary ?karliak wrote:I get this data int the log :
04/06/2006 07:00:03 PM - CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
Also, can you post your cactid.conf and include/config.php ?
But in the graphs are not some data, it is still blank...
- Attachments
-
- this is a example of the cacti graphs :-/ Where are data ?
- cacti1.png (24.99 KiB) Viewed 4714 times
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Are you trying to use the "Localhost - xxxx" templates on your Cacti server, or another one ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
Cannot connect to MySQL server on 'localhost'. Please..
Having the same problem but I beleive for a different reason:
The result is that http://host1/cacti/ doesn't output anything.
tail -f /etc/httpd/logs/error_log
[client x.x.x.x] PHP Warning: mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 355
[root@host1 cacti]# ps -ef | grep mysql
root 14127 13477 0 11:07 pts/2 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql 14148 14127 0 11:07 pts/2 00:00:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/host1.domain.local.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock
I thinks this is the problem. It's is trying to locate the socket through /var/lib/mysql/mysql.sock but my installation output's to /tmp/mysql.sock.
As a result it thinks I don't have mysql running and it can connect.
How can I change it?
Any comments on this?
Best regards.
The result is that http://host1/cacti/ doesn't output anything.
tail -f /etc/httpd/logs/error_log
[client x.x.x.x] PHP Warning: mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 355
[root@host1 cacti]# ps -ef | grep mysql
root 14127 13477 0 11:07 pts/2 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql 14148 14127 0 11:07 pts/2 00:00:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/host1.domain.local.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock
I thinks this is the problem. It's is trying to locate the socket through /var/lib/mysql/mysql.sock but my installation output's to /tmp/mysql.sock.
As a result it thinks I don't have mysql running and it can connect.
How can I change it?
Any comments on this?
Best regards.
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Re: Cannot connect to MySQL server on 'localhost'. Please..
Hieumerus wrote:I thinks this is the problem. It's is trying to locate the socket through /var/lib/mysql/mysql.sock but my installation output's to /tmp/mysql.sock.
As a result it thinks I don't have mysql running and it can connect.
How can I change it?
Any comments on this?
Best regards.
it can be changed in php.ini :
Code: Select all
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
Re: Cannot connect to MySQL server on 'localhost'. Please..
Thanks a lot! It is Done.fmangeant wrote:Hieumerus wrote:I thinks this is the problem. It's is trying to locate the socket through /var/lib/mysql/mysql.sock but my installation output's to /tmp/mysql.sock.
As a result it thinks I don't have mysql running and it can connect.
How can I change it?
Any comments on this?
Best regards.
it can be changed in php.ini :You'll have to restart Apache for the change to take effect.Code: Select all
; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. mysql.default_socket =
Who is online
Users browsing this forum: No registered users and 1 guest