MySQL错误文件[关闭]

Posted

技术标签:

【中文标题】MySQL错误文件[关闭]【英文标题】:MySQL Error Files [closed] 【发布时间】:2014-01-29 15:08:24 【问题描述】:

如何解决这个问题?

陈? chown:更改/var/lib/mysql/ibdata1': Operation not permitted chown: changing ownership of/var/lib/mysql/denora' 的所有权:不允许操作 chown:更改/var/lib/mysql/anope': Operation not permitted chown: changing ownership of/var/lib/mysql/test'的所有权:不允许操作 chown:更改/var/lib/mysql/Animachat.svipchat.org.err': Operation not permitted chown: changing ownership of/var/lib/mysql/vpsgabriel.svipchat.org.err 的所有权:不允许操作 chown:更改/var/lib/mysql/ib_logfile1': Operation not permitted chown: changing ownership of/var/lib/mysql/mysql'的所有权:不允许操作 chown:更改 /var/lib/mysql/wp': Operation not permitted chown: changing ownership of/var/lib/mysql/ib_logfile0' 的所有权:不允许操作

MysqlD 开始了吗?

[root@SSH mysql]# sudo /etc/init.d/mysqld restart 停止 mysqld:[确定] MySQL 守护程序无法启动。 启动 mysqld:[失败]

记录 MySQLd:

140129 09:39:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140129  9:39:37 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
140129  9:39:37  InnoDB: Initializing buffer pool, size = 8.0M
140129  9:39:37  InnoDB: Completed initialization of buffer pool
140129  9:39:37  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.
140129 09:39:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140129 09:40:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140129  9:40:05 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
140129  9:40:05  InnoDB: Initializing buffer pool, size = 8.0M
140129  9:40:05  InnoDB: Completed initialization of buffer pool
140129  9:40:05  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.
140129 09:40:05 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140129 09:42:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140129  9:42:02 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
140129  9:42:02  InnoDB: Initializing buffer pool, size = 8.0M
140129  9:42:02  InnoDB: Completed initialization of buffer pool
140129  9:42:02  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.
140129 09:42:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140129 09:44:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140129  9:44:55 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
140129  9:44:55  InnoDB: Initializing buffer pool, size = 8.0M
140129  9:44:55  InnoDB: Completed initialization of buffer pool
140129  9:44:55  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.
140129 09:44:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

【问题讨论】:

-1 表示不阅读日志:The error means mysqld does not have the access rights to the directory. Chmod ? chmod:更改Animachat.svipchat.org.err': Operation not permitted chmod: changing permissions of anope'的权限:不允许操作 chmod:更改denora': Operation not permitted chmod: changing permissions of ib_logfile0'的权限:不允许操作 chmod:更改ib_logfile1': Operation not permitted chmod: changing permissions of ibdata1'的权限:不允许操作 【参考方案1】:

运行 MySQL 守护程序的用户无权写入您的数据库目录。

如果您使用默认设置的标准安装,以下命令应该可以解决该问题(根据您编辑的输出编辑添加 sudo:如果您可以以 root 运行,请不要使用 sudo ):

sudo chown -R mysql:mysql /var/lib/mysql

您可以通过在/etc/my.cnf/etc/mysql/my.cnf 中查找user= 选项来准确找到用户(如果不是mysql)。

【讨论】:

chown 前加上sudo。我已根据您的输出进行了编辑。 [root@SSH mysql]# sudo chown -R mysql:mysql /var/lib/mysql chown: 更改 `/var/lib/mysql/ibdata1' 的所有权:不允许操作 /var 是从网络共享安装的吗?是只读文件系统吗? 运行 mount 并查看是否出现以 /var 开头的内容以查看 /var 是否从网络共享挂载。输出还应该显示它是否以只读方式安装,因为您会在输出中看到 ro 而不是 rw [root@SSH mysql]# mount /dev/ploop23328p1 on / type ext4 (rw,relatime,barrier=1,dat ) proc on /proc type proc (rw,relatime) sysfs on /sys在 /dev 上键入 sysfs (rw,relatime)none 在 /dev/pts 上键入 devtmpfs (rw,relatime,mode=755) 在 /dev/pts 上键入 devpts (rw,relatime,gid=5,mode=620,ptnone 在 /dev/shm 类型上tmpfs (rw,relatime) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relat

以上是关于MySQL错误文件[关闭]的主要内容,如果未能解决你的问题,请参考以下文章

如何关闭 PHP + MySQL 错误格式化

错误:MySQL 意外关闭。在 xampp 控制上

MySQL物理文件组成

MySQL日志管理

Xampp 无法在 localhost 中运行 MySQL! - “错误:MySQL 意外关闭。”

《MySQL系列-InnoDB引擎14》文件-日志文件-错误日志