/ 中存储网

MySQL5.5 启动报错的解决方法

2014-07-13 15:56:22 来源:中存储网

在FreeBSD中启动mysql时报错,ERROR! The server quit without updating PID file,通常这是可以查看目录下的.err日志,里面会记录一些具体的错误信息,对排错相当有用,内容如下:

110805 17:30:19 d_safe Starting mysqld daemon with databases from /usr/local/mysql5.5/data

110805 17:30:19 InnoDB: The InnoDB memory heap is disabled

110805 17:30:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins

110805 17:30:19 InnoDB: Compressed tables use zlib 1.2.3

110805 17:30:19 InnoDB: Initializing buffer pool, size = 256.0M

110805 17:30:19 InnoDB: Completed initialization of buffer pool

InnoDB: Error: log file /usr/local/mysql5.5/data/ib_logfile0 is of different size 0 5242880 bytes

InnoDB: than specified in the .cnf file 0 67108864 bytes!

110805 17:30:19 [ERROR] Plugin 'InnoDB' init function returned error.

110805 17:30:19 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

110805 17:30:19 [ERROR] Unknown/unsupported storage engine: InnoDB

110805 17:30:19 [ERROR] Aborting

110805 17:30:19 [Note] /usr/local/mysql5.5/bin/mysqld: Shutdown complete

看到上面红色字体,显示错误是出在日志文件大小上,于是查看mysql的配置文件/etc/my.cnf

# Uncomment the following if you are using InnoDB tables

innodb_data_home_dir = /usr/local/mysql5.5/data

innodb_data_file_path = ibdata1:10M:autoextend

innodb_log_group_home_dir = /usr/local/mysql5.5/data

# You can set .._buffer_pool_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

innodb_buffer_pool_size = 256M

innodb_additional_mem_pool_size = 20M

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_file_size = 64M

innodb_log_buffer_size = 8M

innodb_flush_log_at_trx_commit = 1

innodb_lock_wait_timeout = 50

配置文件中指定了innodb_log_file_size=64M,在看看我的数据库目录下,日志文件大小是不是64M,如下图,发现问题了,日志文件是5242880是5M

找到问题了,解决办法可以更改配置文件,也可以删除现在这个日志,再启动mysql这样它会重新生成这两个日志文件。

怎么会出现这个问题呢?

一般来说,是由于,在my.cnf中关于INNODB的一些配置是被注释的,在没有更改的情况下,系统就使用了默认值,这样,当你把关于innodb的配置选项注释去掉的时候,就会出现这个报错!