2
3

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.

【MYSQL】--initialize specified but the data directory has files in it. Aborting.エラーについて【Docker】

Posted at

先日ポートフォリオアプリを作成中にMYSQLが立ち上がらずexited(1)になってしまったので、備忘録。

とりあえず原因を探るため

docker-compose logs

でログを読むと、、、

error --initialize specified but the data directory has files in it. Aborting.
error he designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

との事。

色々とググって分からないなりに解釈して見た結果、データディレクトリ内の/var/lib/mysql/が邪魔だぞと
言っていそうなので/var/lib/mysql/のファイルを削除。

それでもエラーが治らないので、databaseフォルダ内の中身を全て削除で無事起動することができました!

自分の環境はNext.js×Rails×Dockerだったので、Railsの方が次はエラーになり、
db:migrateやdb:createを使ってdbを新しく作り直し無事apiサーバーとMYSQL両方とも立ち上げることに成功しました!!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?