栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

docker 启动mysql 成功又退出,无法正常启动

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

docker 启动mysql 成功又退出,无法正常启动

docker 启动mysql 成功又退出,无法正常启动
user@host:$ docker logs mysql:5.7
2021-11-30 02:36:51+00:00 [ERROR] [Entrypoint]: Unable to start server.
2021-11-30 02:36:51+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.36-1debian10 started.
2021-11-30 02:36:52+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-11-30 02:36:52+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.36-1debian10 started.
2021-11-30T02:36:52.425362Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-30T02:36:52.428531Z 0 [Note] mysqld (mysqld 5.7.36) starting as process 1 ...
2021-11-30T02:36:52.435830Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-11-30T02:36:52.435859Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-11-30T02:36:52.435863Z 0 [Note] InnoDB: Uses event mutexes
2021-11-30T02:36:52.435867Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-11-30T02:36:52.435870Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-11-30T02:36:52.435873Z 0 [Note] InnoDB: Using Linux native AIO
2021-11-30T02:36:52.438293Z 0 [Note] InnoDB: Number of pools: 1
2021-11-30T02:36:52.442858Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-11-30T02:36:52.448428Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-11-30T02:36:52.449553Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2021-11-30T02:36:52.449571Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2021-11-30T02:36:52.449576Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-11-30T02:36:52.449582Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-11-30T02:36:52.449587Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-11-30T02:36:52.449593Z 0 [ERROR] Failed to initialize builtin plugins.
2021-11-30T02:36:52.449597Z 0 [ERROR] Aborting

2021-11-30T02:36:52.449602Z 0 [Note] Binlog end
2021-11-30T02:36:52.449655Z 0 [Note] Shutting down plugin 'CSV'
2021-11-30T02:36:52.450691Z 0 [Note] mysqld: Shutdown complete

【原因】
虚拟内存不够,无法启动mysql

【检查方法】

user@host:$ free
              total        used        free      shared  buff/cache   available
Mem:         987520      620656      129800        4908      237064      199376
Swap:             0           0           0

【解决方法】
启动swap

user@host:$ dd if=/dev/zero of=/swapfile bs=1M count=1024
024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 6.63477 s, 162 MB/s

user@host:$ mkswap /swapfile
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=46f2c2e7-102f-4faf-9691-f7e6139855ff
user@host:$ swapon /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.

重启容器

user@host:$ docker start mysql
ConTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS          PORTS                     NAMES
16f276y7d93   mysql:5.7                   "docker-entrypoint.s…"    30 minutes ago   Up 5 seconds    127.0.0.1:3306->3306/tcp  mysql
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/618843.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号