Linux 中文件和文件夹获取 Mysql 权限(selinux)
2012-04-27 14:54
267 查看
今天在 linux 系统上移动 Mysql 的数据库目录
配置如下:
/etc/my.cnf
[mysqld]
datadir=/home/mysql
socket=/var/lib/mysql/mysql.sock
更改完配置文件重启MYSQL的时候出现的以下问题
110222 11:15:07 mysqld_safe Starting mysqld daemon with databases from /home/mysql
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110222 11:15:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110222 11:15:07 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 ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110222 11:15:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
当初以为只是文件或文件夹权限问题,把所有对应的目录和文件的权限改成读写状态...还是没用...
在网上找了一会儿,找到解决方法了~
解决方法如下:
#在终端中先输入下面这一行
chown -R mysql:mysql /home/data/mysql
#在输入下面的一行就OK了
chcon -R -t mysqld_db_t /home/mysql
#重启下MYSQL试试~
/etc/init.d/mysqld restart
配置如下:
/etc/my.cnf
[mysqld]
datadir=/home/mysql
socket=/var/lib/mysql/mysql.sock
更改完配置文件重启MYSQL的时候出现的以下问题
110222 11:15:07 mysqld_safe Starting mysqld daemon with databases from /home/mysql
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110222 11:15:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110222 11:15:07 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 ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110222 11:15:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
当初以为只是文件或文件夹权限问题,把所有对应的目录和文件的权限改成读写状态...还是没用...
在网上找了一会儿,找到解决方法了~
解决方法如下:
#在终端中先输入下面这一行
chown -R mysql:mysql /home/data/mysql
#在输入下面的一行就OK了
chcon -R -t mysqld_db_t /home/mysql
#重启下MYSQL试试~
/etc/init.d/mysqld restart
相关文章推荐
- linux下修改文件夹及子文件夹和文件的权限(fedora 15)
- Linux学习笔记:chmod 修改文件或文件夹权限
- Linux之文件类型和权限的获取与操作
- linux修改文件夹、文件目录权限 大全
- Linux下批量修改文件及文件夹所有者及权限
- linux 文件夹-文件权限设置
- Linux修改文件及文件夹权限(转)
- linux修改文件夹及文件权限的命令
- Linux文件操作详解(二)--文件/文件夹的权限更改(chmod命令)
- Linux中chmod命令:修改文件或文件夹的权限
- linux chmod命令参数及用法详解--文件文件夹权限设定命令
- linux修改文件夹 文件目录权限
- linux setfacl 命令基本用法 将文件夹以及文件夹下子文件以及新生文件的权限赋予给用户
- Linux 服务器如何设置文件和文件夹的读写权限
- Linux修改文件夹或文件权限
- 设置 Linux 文件和文件夹权限的方法
- Linux教程:Bash技巧,让chmod只修改某个目录下文件夹或者文件的权限
- linux更改文件夹权限,更改文件所有者
- linux下的文件或文件夹的权限
- Linux 修改文件/文件夹权限