Mysql意外关闭导致网页报错

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

登录上服务器发现mysql已关闭,重启mysqld服务失败

查看mysql日志,如下


110822 13:02:34 mysqld_safe Starting mysqld daemon with databases from /var/data/mysql

110822 13:02:34 [Warning] The syntax '--skip-locking' is deprecated and will be removed in a future release. Pleas                            e use --skip-external-locking instead.

110822 13:02:34 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in a future release. P                            lease use '--slow_query_log'/'--slow_query_log_file' instead.

110822 13:02:34 [Warning] The syntax '--default-character-set' is deprecated and will be removed in a future relea                            se. Please use --character-set-server instead.

110822 13:02:34 [Warning] option 'innodb-file-io-threads': signed value 2 adjusted to 4

110822 13:02:34  InnoDB: Error: cannot allocate 268451840 bytes of

InnoDB: memory with malloc! Total allocated memory

InnoDB: by InnoDB 5203168 bytes. Operating system errno: 12

InnoDB: Check if you should increase the swap file or

InnoDB: ulimits of your operating system.

InnoDB: On FreeBSD check you have compiled the OS with

InnoDB: a big enough maximum process size.

InnoDB: Note that in most 32-bit computers the process

InnoDB: memory space is limited to 2 GB or 4 GB.

InnoDB: We keep retrying the allocation for 60 seconds...

InnoDB: Fatal error: cannot allocate the memory for the buffer pool

110822 13:03:34 [ERROR] Plugin 'InnoDB' init function returned error.

110822 13:03:34 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

110822 13:03:34 [ERROR] Unknown/unsupported table type: InnoDB

110822 13:03:34 [ERROR] Aborting


110822 13:03:34 [Note] /opt/app/mysql/libexec/mysqld: Shutdown complete


分析:从错误日志上可以看出是属于memory问题
解决办法:修个配置文件mysql.cnf中的innodb_buffer_pool_size = 128M (原来是256M)
                    很多人都会想到InnoDB的原因所导致的,其实不然。
重启mysql成功