Home  >  Article  >  Database  >  What to do if MySQL is out of memory

What to do if MySQL is out of memory

coldplay.xixi
coldplay.xixiOriginal
2020-10-20 16:22:053185browse

Solution to insufficient memory in MySQL: 1. Increase swap space, the code is [dd if=/dev/zero of=/swapfile bs=1M count=1024]; 2. Increase automatic mounting, in File [add /swapfileswap to /etc/fstab].

What to do if MySQL is out of memory

Solution to insufficient MySQL memory:

1. It has been unsuccessful when starting MySQL. Check the error log/ var/log/mysql/error.log

What to do if MySQL is out of memory

2. The main error messages are as follows:

[ERROR] InnoDB: mmap (136151040 bytes) failed; errno 12

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

[ERROR] InnoDB: Plugin initialization aborted with error Generic error

[ERROR] Plugin 'InnoDB' init function returned error.

[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

[ERROR] Failed to initialize plugins.

[ERROR] Aborting

3. After querying, it is because of insufficient memory. Check the memory

What to do if MySQL is out of memory

Increase swap space to solve the problem:

dd if=/dev/zero of=/swapfile bs=1M count=1024

mkswap /swapfile

swapon /swapfile

What to do if MySQL is out of memory

4. Add automatic mounting:

Add /swapfile swap to the file /etc/fstab swap defaults 0 0

service mysql start started successfully

5 , Remarks:

Generate empty file

dd if=/dev/zero of=1.txt bs=1M count=2 生成一个指定大小的空文件
if=文件名:输入文件名
of=文件名:输出文件名
bs=字节大小
count=个数

More related free learning recommendations: mysql tutorial(video)

The above is the detailed content of What to do if MySQL is out of memory. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn