FrontPage>DockerのMySQLが起動しない問題、exFATのせいだった

DockerのMySQLが起動しない問題、exFATのせいだった

投稿日: 2025-03-10 (月)

はじめに

Docker上でphp上のLaravelを扱うためにMySQLをdocker-composeを使って設定したのだが、バインドマウントを使うとエラーが出てMySQLが起動しない。もしくは起動しようとしてもすぐに落ちる。
最初からずばり言うと原因は「exFATではシンボリックリンクを利用できない」という。

エラーログ

>docker logs db
2025-03-10 12:40:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.2.0-1.el9 started.
2025-03-10 12:40:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-03-10 12:40:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.2.0-1.el9 started.
ln: failed to create symbolic link '/var/lib/mysql/mysql.sock': Operation not permitted
2025-03-10T12:40:10.236715Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-03-10T12:40:10.434941Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.2.0) starting as process 1
2025-03-10T12:40:10.440016Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2025-03-10T12:40:10.464379Z 0 [Warning] [MY-000054] [Server] World-writable config file '/var/lib/mysql/auto.cnf' is ignored.
2025-03-10T12:40:10.465303Z 0 [Warning] [MY-010107] [Server] World-writable config file '/var/lib/mysql/auto.cnf' has been removed.
2025-03-10T12:40:10.465840Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ce08c379-fdac-11ef-8983-0242ac120005.    
2025-03-10T12:40:10.528599Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-03-10T12:40:14.210872Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-03-10T12:40:17.666898Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue.
2025-03-10T12:40:17.666952Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
mysqld: Cannot change permissions of the file 'private_key.pem.temp' (OS errno 1 - Operation not permitted)
2025-03-10T12:40:17.824490Z 0 [ERROR] [MY-010295] [Server] Could not set file permission for private_key.pem
2025-03-10T12:40:17.824537Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-03-10T12:40:19.634094Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.2.0)  MySQL Community Server - GPL.
2025-03-10T12:40:19.634130Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2025-03-10 12:41:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.2.0-1.el9 started.
2025-03-10 12:41:28+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-03-10 12:41:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.2.0-1.el9 started.
ln: failed to create symbolic link '/var/lib/mysql/mysql.sock': Operation not permitted
2025-03-10T12:41:28.391010Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-03-10T12:41:28.589944Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.2.0) starting as process 1
2025-03-10T12:41:28.594564Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2025-03-10T12:41:28.632213Z 0 [Warning] [MY-000054] [Server] World-writable config file '/var/lib/mysql/auto.cnf' is ignored.
2025-03-10T12:41:28.633086Z 0 [Warning] [MY-010107] [Server] World-writable config file '/var/lib/mysql/auto.cnf' has been removed.
2025-03-10T12:41:28.633652Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: xxx.    
2025-03-10T12:41:28.695202Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-03-10T12:41:32.222708Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-03-10T12:41:35.619653Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue.
2025-03-10T12:41:35.619699Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
mysqld: Cannot change permissions of the file 'private_key.pem.temp' (OS errno 1 - Operation not permitted)
2025-03-10T12:41:35.834933Z 0 [ERROR] [MY-010295] [Server] Could not set file permission for private_key.pem
2025-03-10T12:41:35.834972Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-03-10T12:41:37.636223Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.2.0)  MySQL Community Server - GPL.
2025-03-10T12:41:37.636265Z 0 [System] [MY-015016] [Server] MySQL Server - end.

ホスト(Windows)とコンテナ(WSLのLinux)との権限の差異により、バインドマウントしている先のフォルダに書き込むも同期できないよう。
で、そのMySQLはシンボリックリンクを使っているそう

つまり、NTFSなどのシンボリックリンクをサポートしているファイルシステムを用いるとこれは解決できそうだ。

対処法.1

先ほど述べたようにNTFSなどのシンボリックリンクをサポートしているファイルシステムにバインドマウントする場所を変更するとよさそうだ。
私はexFATのHDDからNTFSのHDDにバインドマウント先を含め、docker-compose.ymlの入っているフォルダを移動させた。

対処法.2

my.cnfもしくはmy.confで以下の設定を追記すると起動できると思われる

[mysqld]
skip-symbolic-links

これにより、MySQLがシンボリックリンクをしないようにして対処する。

コメント

コメントはありません。 Comments/DockerのMySQLが起動しない問題、exFATのせいだった

お名前:
URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White

キーワード: 情報技術, Docker, コンテナ, MySQL, データベース, エラー, バグ, シンボリックリンク, ファイルシステム, NTFS, exFAT, FAT32, docker-compose

検索

 

プロフィール

Pitan
pitan_prof.png
プログラミングや音MADやらが趣味
Table of Contents

最新のページ

最新の5件
2026-05-19 2025-08-05 2025-07-10

[もっと見る]

タグ

[もっと見る]

人気のページ

人気の5件

リンク

カウンター

合計: 608
今日: 1
昨日: 0
オンライン: 1
  編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2025-03-10 (月) 22:25:58