mysql5.5 啟動報錯:ERROR!

 

在FreeBSD中啟動mysql時報錯,ERROR! The server quit without updating PID file,通常這是可以查看數據庫目錄下的.err日志,裡面會記錄一些具體的錯誤信息,對排錯相當有用,內容如下:

110805 17:30:19 mysqld_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的配置選項註釋去掉的時候,就會出現這個報錯!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *