160913 01:54:42 mysqld_safe Starting mysqld daemon with databases from /data/mysqldb 2016-09-13 01:54:46 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.31-log) starting as process 14386 ... 2016-09-13 01:54:47 14386 [Warning] option 'innodb-buffer-pool-instances': signed value -1 adjusted to 0 /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 2016-09-13 01:54:47 14386 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2016-09-13 01:54:47 14386 [Note] InnoDB: Using atomics to ref count buffer pool pages 2016-09-13 01:54:47 14386 [Note] InnoDB: The InnoDB memory heap is disabled 2016-09-13 01:54:47 14386 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-09-13 01:54:47 14386 [Note] InnoDB: Memory barrier is not used 2016-09-13 01:54:47 14386 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-09-13 01:54:47 14386 [Note] InnoDB: Using CPU crc32 instructions 2016-09-13 01:54:47 14386 [Note] InnoDB: Initializing buffer pool, size = 1.0G InnoDB: mmap(137363456 bytes) failed; errno 12 2016-09-13 01:54:47 14386 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2016-09-13 01:54:47 14386 [ERROR] Plugin 'InnoDB' init function returned error. 2016-09-13 01:54:47 14386 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2016-09-13 01:54:47 14386 [ERROR] Unknown/unsupported storage engine: InnoDB 2016-09-13 01:54:47 14386 [ERROR] Aborting 2016-09-13 01:54:47 14386 [Note] Binlog end 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'partition' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2016-09-13 01:54:47 14386 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
说是缓存分配失败那就看一下缓存呗
[root@ip-172-31-27-132 log]# free -m total used free shared buff/cache available Mem: 991 70 787 12 133 778 Swap: 0 0 0
发现自己根本就没有配置缓存。。这个就尴尬了,下面有解决方法
解决方法:
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://stackoverflow.com/questions/10284532/amazon-ec2-mysql-aborting-start-because-innodb-mmap-x-bytes-failed-errno-12