mysql – 启动错误InnoDB: mmap(137363456 bytes) failed; errno 12

上午mysql出现了问题,很纠结,最后找到了原因,原因是内存不够用;

190925  9:25:01 [Note] Plugin ‘FEDERATED’ is disabled.
190925  9:25:01 InnoDB: The InnoDB memory heap is disabled
190925  9:25:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190925  9:25:01 InnoDB: Compressed tables use zlib 1.2.7
190925  9:25:01 InnoDB: Using Linux native AIO
190925  9:25:01 InnoDB: Initializing buffer pool, size = 1.0G
InnoDB: mmap(1098907648 bytes) failed; errno 12
190925  9:25:01 InnoDB: Completed initialization of buffer pool
190925  9:25:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
190925  9:25:01 [ERROR] Plugin ‘InnoDB’ init function returned error.
190925  9:25:01 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
190925  9:25:01 [ERROR] Unknown/unsupported storage engine: InnoDB
190925  9:25:01 [ERROR] Aborting

190925  9:25:01 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

查看内存显示  
[root@AY1305070924544 /]# free -m
             total       used       free     shared    buffers     cached
Mem:           995        928         66          0          6         19
-/+ buffers/cache:        903         91
Swap:            0          0          0

重启错误提示 

[root@AY1305070924544 /]# /etc/init.d/mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/var/mysql/data/AY1305070924544.pid).
[root@AY1305070924544 /]# /etc/init.d/mysqld restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/mysql/data/AY1305070924544.pid).

这个其实日志里面说的很明白就是 mysql要占用内存的时候 物理内存不够用导致的 所有 vim /etc/my.cnf
[inonodb]
innodb_buffer_pool_size=64MB  把这个数值改小 高版本的默认是128mb  版本的默认是8Mb