(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)报错:显示用户不可用

解决方法: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稍等片刻刷新页面即可