mysql数据库failed解决方法

时间:2025-04-09 22:09:07

我的问题

2020-05-24T03:10:44.223947Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-24T03:10:44.256496Z 0 [ERROR] [MY-012681] [InnoDB] mmap(137428992 bytes) failed; errno 12
2020-05-24T03:10:44.256861Z 1 [ERROR] [MY-012956] [InnoDB] Cannot allocate memory for the buffer pool
2020-05-24T03:10:44.256950Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2020-05-24T03:10:44.258439Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2020-05-24T03:10:44.258767Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-05-24T03:10:44.258890Z 0 [ERROR] [MY-010119] [Server] Aborting

mysql查询日志是上述问题:

由于我使用的mysql数据库是8.0的,可以使用free -m查询系统剩余空间;

                total        used        free      shared  buff/cache   available
Mem:            583         467          37           1          78          31
Swap:             0           0           0

解决方法:

sudo mysqld -innodb-buffer-pool-size=64M

使用上面shell命令配置--innodb-buffer-pool-size,再重启数据库就可以了。