安裝cacti過程中的各種報錯以及解決方法

(1)Starting MySQL... ERROR! The server quit without updating PID file 

原因:沒有初始化權限表

解決方法:

[root@localhost ~]# cd /usr/local/mysql

[root@localhost mysql]# chown -R mysql.mysql .

[root@localhost mysql]# su - mysql

(2)報錯:This account is currently not available(顯示用戶不可用)

原因:用戶被指定到/sbin/nologin下了

解決方法:usermod -s /bin/bash mysql

[mysql@localhost ~]$ cd /usr/local/mysql

[mysql@localhost mysql]$ scripts/mysql_install_db

Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

[mysql@localhost mysql]$ /usr/local/mysql/bin/mysqld_safe --user=mysql &

[1] 11767
[mysql@localhost mysql]$ 120502 07:01:17 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
120502 07:01:17 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[mysql@localhost mysql]$ /etc/rc.d/init.d/mysql statusMySQL running (11830)                                      

(3)報錯:ERROR! MySQL is running but PID filecould not be found
原因:最常見的通常是PID進程未全部關閉
比如啓動safe mysqld進程後
未關閉

運行 /etc/init.d/mysql status
會提示
ERROR! MySQL is running but PID file could not be found

解決方法:

先打印MYSQL進程
ps aux | grep mysql

然後KILL進程
kill -9 pid1 pid2 …

在啓動MYSQL
/etc/init.d/mysql start在檢查
/etc/init.d/mysql status
SUCCESS! MySQL running (10021)這個只是其中一個原因
還有其他的 大部分的錯誤可以在日誌裏查看到
Centos mysql的日誌
在/var/lib/mysql/主機頭名稱xxx.err

4)在安裝cacti的頁面報錯:

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

原因:

1)、查看config.php下,是否配置正確
查看cactiusr的host是否有localhost 權限 

mysql -ucactiuser -h localhost -p

查看登錄是否成功 ,如果登錄正常則排除
2)、MYSQL權限問題 

SQL>GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';

3)、當mysql中的所有配置和cacti的config.php都正確,卻還是出現該錯誤時,那就是mysql套接字的原因了~
cacti會自動的去查找/var/lib/mysql/mysql.sock 該套接字,但是如果是源碼安裝的mysql,未指定套接字位置時,套接字的位置爲/tmp/mysql.sock,由於cacti未找到/var/lib/mysql/mysql.sock,所以顯示的是“Cannot connect to MySQL server on 'localhost'”

解決:做一個/tmp/mysql.sock到/var/lib/mysql/mysql.sock的軟連接 

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

 

(5)Cacti圖形顯示紅叉

執行/usr/bin/php /var/www/html/cacti/poller.php稍等片刻刷新頁面即可

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章