运行cacti的问题Cannot connect to MySQL server on ‘localhost’.Please make sure you have specified a valid MySQL database name in ‘include/config.php’

参考以次的教程http://blog.haohtml.com/archives/9428,在centos安装cacti监控工具,发现在命令行下运行

php /var/www/html/cacti/poller.php

的时候,提示以下错误

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

而这此配置文件是没有任何问题的,cacti后台访问一切正常的。poller.php是使用/var/lib/mysql/mysql.sock的,

当我在my.cnf里把mysql.sock定义到/var/lib/mysql/mysql.sock时,poller.php可以连接,
但执行mysql就提示错误了,我把mysql.sock的位置改为/tmp/mysql.sock,使用网上提供解决办法:

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

问题解决了。

8 thoughts on “运行cacti的问题Cannot connect to MySQL server on ‘localhost’.Please make sure you have specified a valid MySQL database name in ‘include/config.php’

  1. Pingback: devops consulting

  2. Pingback: Matthew Erausquin Consumer Litigation Associates

  3. Pingback: quality home service

  4. Pingback: human hair wigs

  5. Pingback: rolex replica

  6. Pingback: KIU

  7. Pingback: Saitek Video games manuals

  8. Pingback: human hair wigs

Comments are closed.