Mysql日常死机

标签 mysql innodb

Mysql 占用了所有 RAM 并最终断开连接。它可以工作大约一天。大约早上 7 点,它下降了。非常感谢有关如何解决此问题的任何指示。

mysql error.log 文件:

170912  7:52:56 [Note] Plugin 'FEDERATED' is disabled.
170912  7:52:56 InnoDB: The InnoDB memory heap is disabled
170912  7:52:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170912  7:52:56 InnoDB: Compressed tables use zlib 1.2.8
170912  7:52:56 InnoDB: Using Linux native AIO
170912  7:52:56 InnoDB: Initializing buffer pool, size = 300.0M
170912  7:52:56 InnoDB: Completed initialization of buffer pool
170912  7:52:56 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 4603050230
170912  7:52:56  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 4603057481
170912  7:52:57  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
170912  7:52:57  InnoDB: Waiting for the background threads to start
170912  7:52:58 InnoDB: 5.5.55 started; log sequence number 4603057481
170912  7:52:58 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
170912  7:52:58 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
170912  7:52:58 [Note] Server socket created on IP: '127.0.0.1'.
170912  7:52:58 [Note] Event Scheduler: Loaded 0 events
170912  7:52:58 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.55-0+deb8u1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Debian)
170912  7:53:06 [Note] Plugin 'FEDERATED' is disabled.
170912  7:53:06 InnoDB: The InnoDB memory heap is disabled
170912  7:53:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170912  7:53:06 InnoDB: Compressed tables use zlib 1.2.8
170912  7:53:06 InnoDB: Using Linux native AIO
170912  7:53:06 InnoDB: Initializing buffer pool, size = 300.0M
InnoDB: mmap(321945600 bytes) failed; errno 12
170912  7:53:06 InnoDB: Completed initialization of buffer pool
170912  7:53:06 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170912  7:53:06 [ERROR] Plugin 'InnoDB' init function returned error.
170912  7:53:06 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170912  7:53:06 [ERROR] Unknown/unsupported storage engine: InnoDB
170912  7:53:06 [ERROR] Aborting

170912  7:53:06 [Note] /usr/sbin/mysqld: Shutdown complete

如果我增加缓冲池大小,服务器会更快宕机。

最佳答案

这个错误: 170912 7:53:06 InnoDB: fatal error :无法为缓冲池分配内存

告诉您缓冲池大小不足以启动 InnoDB。

编辑/etc/MySQL/my.cnf 如果不是我那个目录,那么执行 find/-name my.cnf

搜索 innodb_buffer_pool_size =

将您当前拥有的值降低到小于 50% 的 ram。

innodb_buffer_pool_size = 20M

或者,您可以通过跳过 innodb 来启动 MySQL。

sudo -u mysql mysqld --skip-innodb --default-storage-engine=myisam

关于Mysql日常死机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46171497/

相关文章:

mysql - 如何在mysql中插入外键

mysql - 无痛数据库架构更改

mysql - 优化表以提高性能

mysql - SQL 使用任意 IN 子句选择所有内容

mysql - symfony2 和 doctrine mysql 唯一约束错误信息

mysql - MariaDB:未知数据类型 "MYSQL_JSON"

mysql - InnoDB:在现有表中查找聚集索引

Mysql没有使用任何索引

mysql 使用 NOT IN 最快的方法

MySQL:更新找到匹配项,但不进行更改。为什么?