081007 15:08:53 mysqld started
081007 15:08:53 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.
081007 15:08:53 mysqld ended
初步分析是权限问题,从网上搜了一些资料,以下是比较完整的说明,但没有具体解决方案
If InnoDB prints an operating system error
during a file operation, usually the problem has one of the
following causes:
You did not create the
InnoDBdata file directory or theInnoDBlog directory.mysqld does not have access rights to create files in those directories.
mysqld cannot read the proper
my.cnformy.inioption file, and consequently does not see the options that you specified.The disk is full or a disk quota is exceeded.
You have created a subdirectory whose name is equal to a data file that you specified, so the name cannot be used as a filename.
There is a syntax error in the
innodb_data_home_dirorinnodb_data_file_pathvalue.
If something goes wrong when InnoDB attempts
to initialize its tablespace or its log files, you should delete
all files created by InnoDB. This means all
ibdata files and all
ib_logfile files. In case you have already
created some InnoDB tables, delete the
corresponding .frm files for these tables
(and any .ibd files if you are using
multiple tablespaces) from the MySQL database directories as
well. Then you can try the InnoDB database
creation again. It is best to start the MySQL server from a
command prompt so that you see what is happening.
后来我在mysql目录(/usr/local/mysql)下执行命令:chown -R root:mysql *。依然启动失败,不过错误变成了如下内容:
081008 15:03:10 mysqld started
InnoDB: Warning: an inconsistent page in the doublewrite buffer
InnoDB: space id 2999620347 page number 5, 0'th page in dblwr buf.
081008 15:03:11 InnoDB: Started
081008 15:03:11 Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
搜到的资料同样将其解释为权限问题,于是执行命令:chown -R mysql:root /var/lib/mysql/mysql。
但启动仍然失败,错误也相同。后来才知道要重建nysql_install_db,再mysqld_safe。即要执行如下命令:bin/mysql_install_db --user=mysql(这里的mysql为用户名)。再启动mysql,成功
当MySQL启动时遇到操作系统错误,通常是因为数据文件目录未创建、权限不足、配置文件读取错误、磁盘空间满或配额超限等问题。解决方法包括删除由mysqld创建的文件,检查权限,特别是对数据库目录的读写权限,以及在必要时重新初始化表空间和日志文件。文中详细描述了在执行chown命令和mysql_install_db后解决MySQL启动失败的问题。
1104

被折叠的 条评论
为什么被折叠?



