我的服务器是CentOS 6.5 64bit,由Remi运行MySQL 5.5.42社区服务器。 我试图通过运行从命令行导入数据库
mysql -u root -p website_database < website_database.sql
input密码并启动SQL后,将显示以下消息:
ERROR 2013 (HY000) at line 288: Lost connection to MySQL server during query
我尝试以超级用户身份重新启动MySQL服务器,但显示以下消息:
# service mysqld restart Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED]
所以我validation了mysql错误日志文件,这里是内容:
150214 20:51:41 mysqld_safe Number of processes running now: 0 150214 20:51:41 mysqld_safe mysqld restarted 150214 20:51:41 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150214 20:51:41 [Note] Plugin 'FEDERATED' is disabled. 150214 20:51:41 InnoDB: The InnoDB memory heap is disabled 150214 20:51:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins 150214 20:51:41 InnoDB: Compressed tables use zlib 1.2.3 150214 20:51:41 InnoDB: Using Linux native AIO 150214 20:51:41 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 150214 20:51:41 InnoDB: Completed initialization of buffer pool 150214 20:51:41 InnoDB: Fatal error: cannot allocate memory for the buffer pool 150214 20:51:41 [ERROR] Plugin 'InnoDB' init function returned error. 150214 20:51:41 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 150214 20:51:41 [ERROR] Unknown/unsupported storage engine: InnoDB 150214 20:51:41 [ERROR] Aborting 150214 20:51:41 [Note] /usr/libexec/mysqld: Shutdown complete 150214 20:51:41 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 150214 20:53:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150214 20:53:29 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150214 20:53:29 [Note] Plugin 'FEDERATED' is disabled. 150214 20:53:29 InnoDB: The InnoDB memory heap is disabled 150214 20:53:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins 150214 20:53:29 InnoDB: Compressed tables use zlib 1.2.3 150214 20:53:29 InnoDB: Using Linux native AIO 150214 20:53:29 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 150214 20:53:29 InnoDB: Completed initialization of buffer pool 150214 20:53:29 InnoDB: Fatal error: cannot allocate memory for the buffer pool 150214 20:53:29 [ERROR] Plugin 'InnoDB' init function returned error. 150214 20:53:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 150214 20:53:29 [ERROR] Unknown/unsupported storage engine: InnoDB 150214 20:53:29 [ERROR] Aborting 150214 20:53:29 [Note] /usr/libexec/mysqld: Shutdown complete 150214 20:53:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
重新启动MySQL服务器的唯一方法是重新启动整个服务器。 即使查看日志文件,我也没有任何线索,你知道可能会发生什么吗? 谢谢。
InnoDB: mmap(137363456 bytes) failed; errno 12
这个错误意味着数据库不能分配内存 ,所以你应该降低innodb_buffer_pool_size值(我不推荐它,因为你的当前设置已经很低了)或者升级你的硬件来获得更多的内存。