mysql的错误日志:
2017-09-13 09:13:36 20572 [Note] Plugin ‘FEDERATED’ is disabled.
2017-09-13 09:13:39 20572 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-09-13 09:13:39 20572 [Note] InnoDB: The InnoDB memory heap is disabled
2017-09-13 09:13:39 20572 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-09-13 09:13:39 20572 [Note] InnoDB: Memory barrier is not used
2017-09-13 09:13:39 20572 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-13 09:13:39 20572 [Note] InnoDB: Using Linux native AIO
2017-09-13 09:13:39 20572 [Note] InnoDB: Using CPU crc32 instructions
2017-09-13 09:13:40 20572 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2017-09-13 09:13:41 20572 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-09-13 09:13:41 20572 [ERROR] Plugin ‘InnoDB’ init function returned error.
2017-09-13 09:13:41 20572 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
2017-09-13 09:13:42 20572 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-09-13 09:13:42 20572 [ERROR] Aborting
如果不知道怎么查看错误日志在哪里的,可以使用以下的命令:
service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service – MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-09-13 09:39:15 CST; 14min ago
Process: 2061 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Main PID: 2060 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─2060 /bin/sh /usr/bin/mysqld_safe –basedir=/usr
└─2357 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –log-error=/var/log…
Sep 13 09:39:08 izj6chpn3pk7tamab9z05iz systemd[1]: Starting MySQL Community Server…
Sep 13 09:39:13 izj6chpn3pk7tamab9z05iz mysqld_safe[2060]: 170913 09:39:13 mysqld_safe Logging to ‘/var/log/mysqld.log’.
Sep 13 09:39:13 izj6chpn3pk7tamab9z05iz mysqld_safe[2060]: 170913 09:39:13 mysqld_safe Starting mysqld daemon with databases fr…mysql
Sep 13 09:39:15 izj6chpn3pk7tamab9z05iz systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.
上面的红色就是日志的地址,以后报错mysql或者mysql启动不了,都可以在这里面查看。
那么出现上文我的这个错误怎么解决了?
第一步:处理innoDB的问题
If you’re using MySQL 5.6+ and want to disable InnoDB, don’t forget “–default-tmp-storage” or it won’t work:To disable InnoDB, use –innodb=OFF or –skip-innodb. In this case, because the default storage engine is InnoDB, the server will not start unless you also use –default-storage-engine and –default-tmp-storage-engine to set the default to some other engine for both permanent and TEMPORARY tables.
You can add this to your my.cnf:
[mysqld]特别注意这个,加到my.cnf中的时候,一定要加在这个的下面
innodb=OFF
ignore-builtin-innodb
skip-innodb
default-storage-engine=myisam
default-tmp-storage-engine=myisam
第二部分,来处理缓存的问题
innodb_buffer_pool_size = 60M 应该在 [mysqld] 这个 section 下。加在my.cnf里面即可。
上面的解决办法其实核心就是使用my.cnf的配置问题,导致mysql的启动问题。