mysql.service: Main process exited, code=exited, status=1/FAILURE
2017-12-27 17:03
169 查看
一、问题现象:
1.服务器(ubuntu 17.04)安装mysql服务时出错。
2.查看日志(cat /var/log/mysql/error.log )发现如下错误:
二、错误原因:
1.是由于操作系统没有配置swapfile(分配swap空间)导致的。
三、解决方案:
1.执行free -m
Swap: 0 表示没有 swapfile.
2.添加swapfile
fallocate size suffixes: g = Giga, m = Mega, etc. (See man fallocate).
If fallocate fails or it not available, you can use dd:
We need to set the swap file permissions to 600 to prevent other users from being able to read potentially sensitive information from the swap file.
Format the file as swap:
Enable use of Swap File
The additional swap is now available and verified with: cat /proc/swaps
Enable Swap File at Bootup
Add the swap file details to /etc/fstab so it will be available at bootup:
四、相关文献
1.https://stackoverflow.com/questions/25965638/mysql-fatal-error-cannot-allocate-memory-for-the-buffer-pool/32932601
2.https://help.ubuntu.com/community/SwapFaq
1.服务器(ubuntu 17.04)安装mysql服务时出错。
2.查看日志(cat /var/log/mysql/error.log )发现如下错误:
2017-12-27T08:36:46.406267Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12 2017-12-27T08:36:46.406283Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2017-12-27T08:36:46.406292Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2017-12-27T08:36:46.406310Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2017-12-27T08:36:46.406319Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2017-12-27T08:36:46.406345Z 0 [ERROR] Failed to initialize plugins. 2017-12-27T08:36:46.406351Z 0 [ERROR] Aborting
二、错误原因:
1.是由于操作系统没有配置swapfile(分配swap空间)导致的。
三、解决方案:
1.执行free -m
total used free shared buffers cached Mem: 604340 587364 16976 0 29260 72280 -/+ buffers/cache: 485824 118516 Swap: 0 0 0
Swap: 0 表示没有 swapfile.
2.添加swapfile
sudo fallocate -l 1g /mnt/1GiB.swap
fallocate size suffixes: g = Giga, m = Mega, etc. (See man fallocate).
If fallocate fails or it not available, you can use dd:
sudo dd if=/dev/zero of=/mnt/1GiB.swap bs=1024 count=1048576
We need to set the swap file permissions to 600 to prevent other users from being able to read potentially sensitive information from the swap file.
sudo chmod 600 /mnt/1GiB.swap
Format the file as swap:
sudo mkswap /mnt/1GiB.swap
Enable use of Swap File
sudo swapon /mnt/1GiB.swap
The additional swap is now available and verified with: cat /proc/swaps
Enable Swap File at Bootup
Add the swap file details to /etc/fstab so it will be available at bootup:
echo '/mnt/1GiB.swap swap swap defaults 0 0' | sudo tee -a /etc/fstab
四、相关文献
1.https://stackoverflow.com/questions/25965638/mysql-fatal-error-cannot-allocate-memory-for-the-buffer-pool/32932601
2.https://help.ubuntu.com/community/SwapFaq
相关文章推荐
- vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
- xl2tpd.service: main process exited, code=exited, status=1/FAILURE
- (samba启动失败)smb.service: main process exited, code=exited, status=1/FAILURE
- mysql.service failed because the control process exited with error code问题
- salt出错Job for salt-master.service failed because the control process exited with error code.
- Centos 7不能上网,Job for iptables.service failed because the control process exited with error code.
- 重启网卡报Job for network.service failed because the control process exited with error code.。。 错误
- centos7 mysql: mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
- centos出现这个错误:Job for sshd.service failed because the control process exited with error code.
- CentOS7启动SSH服务报:Job for ssh.service failed because the control process exited with error code.......
- 解决Job for docker.service failed because the control process exited with error code. See "systemctl s
- Job for vsftpd.service failed because the control process exited with error code. See "systemctl sta
- 解决Docker启动服务器链接失败-Job for docker.service failed because the control process exited error code
- Job for tomcat.service failed because the control process exited with error code 解决办法:
- Jenkins 安装启动提示“iJob for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.”
- Centos 7不能上网,Job for iptables.service failed because the control process exited with error code.
- Dockers Job for docker.service failed because the control process exited with error code
- nginx 启动报错 nginx.service: control process exited, code=exited status=1
- Job for php-fpm.service failed because the control process exited with error code. See "systemctl st
- Job for postfix.service failed because the control process exited with error code. See "systemctl st