安装好MYSQL后启动数据库出错
[root@localhost mysql]# service mysqld start
Starting MySQL..Manager of pid-file quit without updating f[失败]
在网上查了半天,找到的有两种方法,
1、在 my.cnf 中增加了
[mysqld]
port             = 3306
socket          = /tmp/mysql.sock
添加下面一行
datadir         = /var/lib/mysql/

[safe_mysqld]
err-log = /var/log/mysqld.log
pid-file = /var/lib/mysql/localhost.localdomain.pid
重新启动 mysql成功
/usr/local/mysql/var/db1.pid 这个文件名字貌似不能随便指定的
(我指定成了别的是不行的 ,这里的db1是你的hostname)
2、修改改selinux的 我改了 重新启动机器就行了,以下是SELINUX配置文件
[root@localhost selinux]# vi config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
然后重启计算机


但是还是没有成功,看日志

启动后失败
[root@localhost mysql]# /bin/sh /usr/local/mysql/bin/mysqld_safe
081219 22:09:58 mysqld_safe Logging to '/var/lib/mysql//localhost.localdomain.err'.
081219 22:09:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/
081219 22:09:58 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
看日志:
[root@localhost mysql]# cat /var/lib/mysql/localhost.localdomain.err
081219 21:30:38 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
                         ………………………………
                         ………………………………
081219 21:40:21 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete
 
081219 21:40:21 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
081219 21:45:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
081219 21:45:55 [ERROR] /usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'
081219 21:45:55 [ERROR] Aborting

看到这一行
/usr/local/mysql/libexec/mysqld: unknown option '--skip-federated

然后去/etc/my.cnf文件中把skip-federated注释掉后

[root@localhost mysql]# service mysqld start
Starting MySQL.                                            [确定]

重启成功了,呵呵,以后要多看日志多google,配合使用,不能只用一个那样死板,要灵活运用.这个问题花掉偶3个小时呢!!哎,生命啊!!如果下去掉那个选项不可以就试试上面的两个方法。