MySQL终止日志。

230529  2:43:22 [Note] Plugin 'FEDERATED' is disabled.
230529  2:43:22 InnoDB: The InnoDB memory heap is disabled
230529  2:43:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
230529  2:43:22 InnoDB: Compressed tables use zlib 1.2.11
230529  2:43:22 InnoDB: Initializing buffer pool, size = 128.0M
230529  2:43:22 InnoDB: Completed initialization of buffer pool
230529  2:43:22 InnoDB: highest supported file format is Barracuda.
230529  2:43:22  InnoDB: Waiting for the background threads to start
230529  2:43:23 InnoDB: 5.5.62 started; log sequence number 375083003
230529  2:43:23 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
230529  2:43:23 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
230529  2:43:23 [Note] Server socket created on IP: '0.0.0.0'.
230529  2:43:24 [Note] Event Scheduler: Loaded 0 events
230529  2:43:24 [Note] /www/server/mysql/bin/mysqld: ready for connections.
Version: '5.5.62-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
230530  7:57:12 [Note] Plugin 'FEDERATED' is disabled.
230530  8:04:40 InnoDB: The InnoDB memory heap is disabled
230530  8:04:51 InnoDB: Mutexes and rw_locks use GCC atomic builtins
230530  8:05:01 InnoDB: Compressed tables use zlib 1.2.11
230530  8:05:59 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
230530  8:06:21 InnoDB: Completed initialization of buffer pool
230530  8:06:24 InnoDB: Fatal error: cannot allocate memory for the buffer pool
230530  8:06:34 [ERROR] Plugin 'InnoDB' init function returned error.
230530  8:06:42 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
230530  8:08:53 [ERROR] Unknown/unsupported storage engine: InnoDB
230530  8:09:05 [ERROR] Aborting

错误信息表明MySQL中无法为InnoDB缓冲池分配内存的问题。缓冲池是InnoDB存储引擎的重要组件,负责将数据和索引缓存到内存中。

具体来说,错误信息中的"mmap(137363456 bytes) failed; errno 12"表示操作系统无法为缓冲池分配所请求的内存。"errno 12"对应"ENOMEM"错误代码,意味着没有足够的可用内存来满足请求。

解决此问题,可以尝试以下步骤:

  1. 检查系统上的可用内存:确保系统上有足够的空闲内存用于分配给缓冲池。如果系统内存不足,你可能需要停止不必要的进程或添加更多物理内存到服务器。
  2. 调整缓冲池大小:如果有足够的可用内存,可以尝试减小InnoDB缓冲池的大小。默认情况下,在你的情况下,它设置为128MB。你可以修改MySQL配置文件(通常是my.cnfmy.ini)中的innodb_buffer_pool_size配置参数为较小的值。例如,你可以尝试将其设置为64MB甚至更小。
  3. 重启MySQL服务:在对配置文件进行任何更改后,重新启动MySQL服务以应用新的设置。如果你使用的是基于Linux的系统,通常可以通过运行命令sudo service mysql restart来重启服务。
  4. 监控内存使用情况:在进行更改后,密切关注系统和MySQL进程的内存使用情况。如果错误仍然存在,或者系统继续出现与内存相关的问题,你可能需要进一步优化MySQL配置或调查其他可能导致内存消耗过多的因素。

因此,在我的机器中,则需要通过宝塔面板对于Mysql的管理实现调整Mysql的性能占用。

在宝塔面板Mysqld管理中,性能调整页,将优化方案选择1-2GB,innodb_log_buffer_size调整为8MB,保存重启即可解决该问题。