我有一个web服务器,默认安装
mysql将其所有数据库文件放在/ var / lib / MysqL中.安装/ var的分区只有2GB的空间,所以在运行空间问题后,我决定重新定位MysqL的数据目录.
我天真的方法是将/ var / lib / MysqL目录完全复制到/ web / dbs / MysqL,并更改/etc/MysqL/my.cnf以便它读取
datadir = /web/dbs/MysqL
但是,重新启动后,我在MysqL错误日志中收到以下错误,服务器将无法启动.
130130 9:59:23 [Note] Plugin 'FEDERATED' is disabled. /usr/sbin/MysqLd: Can't find file: './MysqL/plugin.frm' (errno: 13) 130130 9:59:23 [ERROR] Can't open the MysqL.plugin table. Please run MysqL_upgrade to create it. 130130 9:59:23 InnoDB: Initializing buffer pool,size = 8.0M 130130 9:59:23 InnoDB: Completed initialization of buffer pool 130130 9:59:23 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.
所有文件和目录都属于MysqL:MysqL.为了测试,我甚至改变了/ web / dbs / MysqL的访问权限,现在是rwxrwxrwx.
是的,/ web / dbs / MysqL / MysqL / plugin.frm确实存在.
这可能是什么问题?我错过了什么吗?是否有更详细的输出日志?
更新:
更多信息:
我使用以下命令重试所有内容:
>我关闭服务器停止MysqL
>我删除了旧数据rm -r / web / dbs / MysqL
>我使用cp -p -r / var / lib / MysqL / / web / dbs /复制
>我将my.cnf中的datadir设置为datadir = / web / dbs / MysqL
>我重新启动了服务器.同样的错误
特权:
drwxr-xr-x 4 MysqL MysqL 34 2013-01-30 15:55 /web/dbs drwx------ 19 MysqL MysqL 4096 2013-01-30 15:44 /web/dbs/MysqL drwx------ 2 MysqL MysqL 4096 2012-10-11 11:25 /web/dbs/MysqL/MysqL -rw-rw---- 1 MysqL MysqL 8586 2012-08-14 19:15 /web/dbs/MysqL/MysqL/plugin.frm
当我将datadir重置为datadir = / var / lib / MysqL时,服务器启动没有问题.
试过以下内容:
root:/# su - MysqL MysqL:~$/usr/sbin/MysqLd --verbose 130130 16:01:05 [Warning] Can't create test file /web/dbs/MysqL/s15800994.lower-test 130130 16:01:05 [Warning] Can't create test file /web/dbs/MysqL/s15800994.lower-test MysqL:~$touch /web/dbs/MysqL/s15800994.lower-test MysqL:~$ls -l /web/dbs/MysqL/s15800994.lower-test -rw-r--r-- 1 MysqL MysqL 0 2013-01-30 16:01 /web/dbs/MysqL/s15800994.lower-test
所以数据目录设置为correclty. MysqL用户具有写访问权限,但MysqL进程无法创建文件.
可能有什么不对?