centos 6 下 mysql 5.6 总是自动停止,重启mysqld 后一会又会自动停止,无线循环,求助呀!

thirtyjin
  • 2
新手上路,请多包涵

1.配置环境

  • 阿里云服务器
  • centos 6.3
  • Apache 2.2.4
  • mysql 5.6
  • php 5.3.3
  • 主要运行的程序为 WordPress

2.问题描述:

mysql 可以启动正常,一切看起来都很正常,网站可以访问,数据库用PHPmyadmin也能访问;但是过一小段时间(10~30分钟不等)就自己停止掉;SSH 命令行中显示如下

# /usr/bin/mysqld_safe: line 183:  9161 Killed                  nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null > /dev/null 2>&1

然后直接启动是不行的会报错如下:

# service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

但是先重启下httpd,紧接着在启动mysqld 就能够正常起来;

# service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]
[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

Mysqld.log 如下;

2017-09-05 23:03:34 10926 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-09-05 23:03:34 10926 [Note] InnoDB: The InnoDB memory heap is disabled
2017-09-05 23:03:34 10926 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-09-05 23:03:34 10926 [Note] InnoDB: Memory barrier is not used
2017-09-05 23:03:34 10926 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-05 23:03:34 10926 [Note] InnoDB: Using Linux native AIO
2017-09-05 23:03:34 10926 [Note] InnoDB: Using CPU crc32 instructions
2017-09-05 23:03:34 10926 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2017-09-05 23:03:34 10926 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-09-05 23:03:34 10926 [ERROR] Plugin 'InnoDB' init function returned error.
2017-09-05 23:03:34 10926 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-09-05 23:03:34 10926 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-09-05 23:03:34 10926 [ERROR] Aborting

2017-09-05 23:03:34 10926 [Note] Binlog end
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'partition'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'FEDERATED'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_METRICS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_CMP'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'INNODB_TRX'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'ARCHIVE'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'BLACKHOLE'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'CSV'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'MEMORY'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'MRG_MYISAM'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'MyISAM'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'sha256_password'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'mysql_old_password'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'mysql_native_password'
2017-09-05 23:03:34 10926 [Note] Shutting down plugin 'binlog'
2017-09-05 23:03:34 10926 [Note] /usr/sbin/mysqld: Shutdown complete


2017-09-05 23:11:21 11670 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-09-05 23:11:21 11670 [Note] InnoDB: The InnoDB memory heap is disabled
2017-09-05 23:11:21 11670 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-09-05 23:11:21 11670 [Note] InnoDB: Memory barrier is not used
2017-09-05 23:11:21 11670 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-05 23:11:21 11670 [Note] InnoDB: Using Linux native AIO
2017-09-05 23:11:21 11670 [Note] InnoDB: Using CPU crc32 instructions
2017-09-05 23:11:21 11670 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-09-05 23:11:21 11670 [Note] InnoDB: Completed initialization of buffer pool
2017-09-05 23:11:21 11670 [Note] InnoDB: Highest supported file format is Barracuda.
2017-09-05 23:11:21 11670 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1600617 in the ib_logfiles!
2017-09-05 23:11:21 11670 [Note] InnoDB: Database was not shutdown normally!
2017-09-05 23:11:21 11670 [Note] InnoDB: Starting crash recovery.
2017-09-05 23:11:21 11670 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-09-05 23:11:21 11670 [Note] InnoDB: Restoring possible half-written data pages 
2017-09-05 23:11:21 11670 [Note] InnoDB: from the doublewrite buffer...
2017-09-05 23:11:21 11670 [Note] InnoDB: 128 rollback segment(s) are active.
2017-09-05 23:11:21 11670 [Note] InnoDB: Waiting for purge to start
2017-09-05 23:11:21 11670 [Note] InnoDB: 5.6.37 started; log sequence number 1600617
2017-09-05 23:11:21 11670 [Note] Server hostname (bind-address): '*'; port: 3306
2017-09-05 23:11:21 11670 [Note] IPv6 is available.
2017-09-05 23:11:21 11670 [Note]   - '::' resolves to '::';
2017-09-05 23:11:21 11670 [Note] Server socket created on IP: '::'.
2017-09-05 23:11:21 11670 [Note] Event Scheduler: Loaded 0 events
2017-09-05 23:11:21 11670 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.37'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

3.尝试过的办法有:
卸载并重装mysql 5.6,问题依旧存在;
百度google搜了很久都没办法解决;

回复
阅读 5.1k
1 个回答

错误日志中最重要的一句:"InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12"
你的物理内存太小了吧

方法一.加大物理内存
方法二.调小innodb_buffer_pool_size

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏