centos6.5里面启动mysql出现PID文件加载失败问题,请问要怎么解决呀?
就是在centos里面安装mysql的时候初始化就报错了,我在网上油进行相关的搜索,但是没有找到对应我这个问题的,求问!谢谢大佬们!...
就是在centos里面安装mysql的时候初始化就报错了,我在网上油进行相关的搜索,但是没有找到对应我这个问题的,求问!谢谢大佬们!
展开
若以下回答无法解决问题,邀请你更新回答
展开全部
1. /etc/my.cnf的默认配置
配置文件的内容如下:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
由于项目需要需要修改datadir的值,如下
datadir=/usr/local/project/etc/data
在CentOS中启动MySQL:
[wzhwho@local~]#service mysqld start
Starting mysqld daemon [FAILED]
2. 先看错误日志
采用rpm安装的MySQL日志文件的默认路径是/var/log/mysqld.log
mysqld started
InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /usr/local/project/etc/data/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
mysqld ended
从日志可以知道,mysql的数据文件目录没有权限,所以我需要按照/var/lib/mysql目录的权限给/usr/local/project/etc/data目录设置权限和属主。
[wzhwho@local~]#ll /var/lib
drwxr-x-r-x 1 mysql mysql 4 Apr 11 2009 mysql
[wzhwho@local~]#ll /var/lib
[wzhwho@local~]chown -R mysql:mysql /usr/local/project/etc/data
[wzhwho@local~]chmod -R 755 /usr/local/project/etc/data
[wzhwho@local~]#ll /usr/local/project/etc
drwxr-x-r-x 1 mysql mysql 4 Apr 11 2009 data
接着我又启动了MySQL,但是还是失败,日志信息还是一样。
3. 修改配置文件/etc/selinux/config
最后,我在外国友人的邮件来往中查到这样的回复:
If you are using SE linux, set it to permissive mode by editing /etc/selinux/config
and changing
SELINUX=enforcing to SELINUX=permissive
This solved all of my problems with the
"Operating system error number 13 in a file operation" error
所以,最后确定为selinux的问题,输入命令ls -Z,你会发现在文件或文件夹上面打的标签。如果一个文件是在selinux打开的时候创建的,那么即使你关闭selinux,它的权限控制还是会起作用的。可以通过chcon来改变权限。
4. MySQL成功启动
[wzhwho@local~]#service mysqld start
Starting mysqld daemon [OK]
配置文件的内容如下:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
由于项目需要需要修改datadir的值,如下
datadir=/usr/local/project/etc/data
在CentOS中启动MySQL:
[wzhwho@local~]#service mysqld start
Starting mysqld daemon [FAILED]
2. 先看错误日志
采用rpm安装的MySQL日志文件的默认路径是/var/log/mysqld.log
mysqld started
InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /usr/local/project/etc/data/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
mysqld ended
从日志可以知道,mysql的数据文件目录没有权限,所以我需要按照/var/lib/mysql目录的权限给/usr/local/project/etc/data目录设置权限和属主。
[wzhwho@local~]#ll /var/lib
drwxr-x-r-x 1 mysql mysql 4 Apr 11 2009 mysql
[wzhwho@local~]#ll /var/lib
[wzhwho@local~]chown -R mysql:mysql /usr/local/project/etc/data
[wzhwho@local~]chmod -R 755 /usr/local/project/etc/data
[wzhwho@local~]#ll /usr/local/project/etc
drwxr-x-r-x 1 mysql mysql 4 Apr 11 2009 data
接着我又启动了MySQL,但是还是失败,日志信息还是一样。
3. 修改配置文件/etc/selinux/config
最后,我在外国友人的邮件来往中查到这样的回复:
If you are using SE linux, set it to permissive mode by editing /etc/selinux/config
and changing
SELINUX=enforcing to SELINUX=permissive
This solved all of my problems with the
"Operating system error number 13 in a file operation" error
所以,最后确定为selinux的问题,输入命令ls -Z,你会发现在文件或文件夹上面打的标签。如果一个文件是在selinux打开的时候创建的,那么即使你关闭selinux,它的权限控制还是会起作用的。可以通过chcon来改变权限。
4. MySQL成功启动
[wzhwho@local~]#service mysqld start
Starting mysqld daemon [OK]
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询