MySQL错误处理汇总
MySQL无法启动
MySQL启动时提示Timeout error occurred trying to start MySQL Daemon
解决办法:执行/usr/bin/mysql_install_db,修复下就OK了.
MySQL数据表无法使用
启动后发现所有的数据表都无法使用,查看MySQL异常日志,发现如下log
[root@AY1212190315567971802 sliuhuamysql]# tail /var/log/mysqld.log
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...
130109 12:32:19InnoDB: Fatal error: cannot allocate the memory for the buffer pool
130109 12:32:19 [ERROR] Plugin 'InnoDB' init function returned error.
130109 12:32:19 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130109 12:32:19 [Note] Event Scheduler: Loaded 0 events
130109 12:32:19 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.58' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) by Utter Ramblings
[root@AY1212190315567971802 sliuhuamysql]# tail -n 20 /var/log/mysqld.log
130109 12:31:17 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130109 12:31:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130109 12:31:19 InnoDB: Initializing buffer pool, size = 256.0M
130109 12:31:19 InnoDB: Error: cannot allocate 268451840 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 7994352 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
原因:这个报错的大意是,内存基本耗尽,没有再可以分配的内存.
解决办法:查看/etc/my.cnf,找innodb_buffer_pool_size,发现设值已经超过了系统总内存,然后重新设置为系统内存1半,即innodb_buffer_pool_size = 6144M 重启MySQL就OK了.