LoginSignup
35
20

More than 3 years have passed since last update.

docker-composeでmysqlのバージョン変えたら起動しなくなった

Last updated at Posted at 2019-11-06

mysqlのバージョンダウン

何の指定もしていなかったのでMySQL8.0になってた。
使わなければならないversionが5.7だったので以下のように変更。

docker-compose.yml
    mysql:
      image: mysql

docker-compose.yml
    mysql:
      image: mysql:5.7

上記変更後にコンテナとイメージを削除したが、以下のようなエラーが出てmysqlが起動しない。

╰─➤  docker-compose logs
Attaching to db, app, datastore
db           | 2019-11-06 08:52:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started.
db           | 2019-11-06 08:52:29+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db           | 2019-11-06 08:52:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started.
db           | 2019-11-06T08:52:30.311329Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db           | 2019-11-06T08:52:30.312624Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 1 ...
db           | 2019-11-06T08:52:30.315158Z 0 [Note] InnoDB: PUNCH HOLE support available
db           | 2019-11-06T08:52:30.315237Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db           | 2019-11-06T08:52:30.315242Z 0 [Note] InnoDB: Uses event mutexes
db           | 2019-11-06T08:52:30.315245Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db           | 2019-11-06T08:52:30.315247Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db           | 2019-11-06T08:52:30.315249Z 0 [Note] InnoDB: Using Linux native AIO
db           | 2019-11-06T08:52:30.315430Z 0 [Note] InnoDB: Number of pools: 1
db           | 2019-11-06T08:52:30.315535Z 0 [Note] InnoDB: Using CPU crc32 instructions
db           | 2019-11-06T08:52:30.326656Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db           | 2019-11-06T08:52:30.332340Z 0 [Note] InnoDB: Completed initialization of buffer pool
db           | 2019-11-06T08:52:30.334084Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db           | 2019-11-06T08:52:30.349831Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
db           | 2019-11-06 08:52:30 0x7fc5052d8740  InnoDB: Assertion failure in thread 140484172154688 in file ut0ut.cc line 918
db           | InnoDB: We intentionally generate a memory trap.
db           | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
db           | InnoDB: If you get repeated assertion failures or crashes, even
db           | InnoDB: immediately after the mysqld startup, there may be
db           | InnoDB: corruption in the InnoDB tablespace. Please refer to
db           | InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
db           | InnoDB: about forcing recovery.
db           | 08:52:30 UTC - mysqld got signal 6 ;
db           | This could be because you hit a bug. It is also possible that this binary
db           | or one of the libraries it was linked against is corrupt, improperly built,
db           | or misconfigured. This error can also be caused by malfunctioning hardware.
db           | Attempting to collect some information that could help diagnose the problem.
db           | As this is a crash and something is definitely wrong, the information
db           | collection process might fail.

ぐぐってみると以下のサイトに同様の現象が出てた。
http://unot13.hatenablog.com/entry/2018/09/01/103148

とりあえず以下のコマンドで起動できた。

コンテナ削除

docker ps -a

上記で出てきたコンテナの削除

docker rm コンテナID

イメージの削除

docker images

上記で出てきたイメージの削除

docker rmi イメージ名

volumeの削除

docker volume ls

上記で出てきたvolumeの削除

docker volume rm VOLUMEのID

buildのやり直し

docker-compose build --no-cache

起動

docker-compose up -d

無事に起動できました。

35
20
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
20