[ERROR] InnoDB: Cannot allocate memory for the buffer pool

 :: mysqld_safe Starting mysqld daemon with databases from /data/mysqldb
-- :: [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.-log) starting as process ...
-- :: [Warning] option 'innodb-buffer-pool-instances': signed value - adjusted to
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
-- :: [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
-- :: [Note] InnoDB: Using atomics to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Memory barrier is not used
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = .0G
InnoDB: mmap( bytes) failed; errno
-- :: [ERROR] InnoDB: Cannot allocate memory for the buffer pool
-- :: [ERROR] Plugin 'InnoDB' init function returned error.
-- :: [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
-- :: [ERROR] Unknown/unsupported storage engine: InnoDB
-- :: [ERROR] Aborting -- :: [Note] Binlog end
-- :: [Note] Shutting down plugin 'partition'
-- :: [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
-- :: [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
-- :: [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FIELDS'

说是缓存分配失败那就看一下缓存呗

[root@ip---- log]# free -m
total used free shared buff/cache available
Mem:
Swap:

发现自己根本就没有配置缓存。。这个就尴尬了,下面有解决方法

解决方法:
1) 在 /etc/mysql/my.cnf 的 mysqld 下增加下面一句:
innodb_buffer_pool_size = 64M(64M每个人配置文件不一样,自己看着改)
还要设置一下swap分区,因为我的vps是没有swap分区的,通过fdisk -l 和 1mount 看不到swap的信息,需要手动添加一下。
2) 添加swap分区的步骤:
2.1) dd if=/dev/zero of=/swapfile bs=1M count=1024
2.2) mkswap /swapfile
2.3) swapon /swapfile
2.4) 添加这行: /swapfile swap swap defaults 0 0 到 /etc/fstab
目前已经设置了swap分区,并重启了mysql,后续观察一下看看还会不会出现吧。
参考:http://*.com/questions/10284532/amazon-ec2-mysql-aborting-start-because-innodb-mmap-x-bytes-failed-errno-12

上一篇:将 java 项目打包成可运行的 jar 包(main 函数带参数),并上传到 linux 服务器上运行


下一篇:Levenshtein Distance算法(编辑距离算法)