3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Docker】DB(MySQL)コンテナ起動後にすぐ落ちる

Posted at

概要

以下の記事を参考にDockerでLEMP環境を構築中、DB(MySQL)コンテナが起動後すぐに落ちる問題が発生。
解決策を書いていきます。

【参考】

結論

ログ系のファイルパスに相対パスを指定すると、意図しないディレクトリに対してchownを実行しようとしてしまうようなので、絶対パスに置き換えることで解決。

/docker/db/my.cnf
[mysqld]
# character
character_set_server = utf8mb4
collation_server = utf8mb4_0900_ai_ci

# timezone
default-time-zone = SYSTEM
log_timestamps = SYSTEM

# Error Log
- log-error = mysql-error.log
+ log-error = /var/log/mysql/error.log

# Slow Query Log
slow_query_log = 1
- slow_query_log_file = mysql-slow.log
+ slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 1.0
log_queries_not_using_indexes = 0

# General Log
general_log = 1
- general_log_file = mysql-general.log
+ general_log_file = /var/log/mysql/general.log

[mysql]
default-character-set = utf8mb4

[client]
default-character-set = utf8mb4

【参考】

ご指摘等ありましたらコメント頂けますと幸いです。

3
2
0

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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?