docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.48k stars 2.21k forks source link

The designated data directory /var/lib/mysql/ is unusable. #1078

Closed TutorialMan7727 closed 4 months ago

TutorialMan7727 commented 4 months ago

Hello, I have had a copy of a db's files saved for some while now and I would like to use it again. However when I copied the db back and started the container it stopped and show the following:

2024-07-29 11:03:47+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-07-29 11:03:47+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.0.1-1.el9 started.
2024-07-29 11:03:47+00:00 [Note] [Entrypoint]: Initializing database files
2024-07-29T11:03:47.592102Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-07-29T11:03:47.593441Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 9.0.1) initializing of server in progress as process 81
2024-07-29T11:03:47.595023Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2024-07-29T11:03:47.595028Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2024-07-29T11:03:47.595076Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-07-29T11:03:47.595531Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

So, I decided to give the container all permissions so it looked like this (I just remove the rest of the files here so it wasnt too long)

-rwxrwxrwx 1 systemd-coredump systemd-coredump  8585216 Jul 29 11:03 '#ib_16384_1.dblwr'
-rwxrwxrwx 1 systemd-coredump systemd-coredump       56 Jul 29 11:02  auto.cnf
-rwxrwxrwx 1 systemd-coredump systemd-coredump  3040348 Jul 29 11:03  binlog.000001
-rwxrwxrwx 1 systemd-coredump systemd-coredump      181 Jul 29 11:03  binlog.000002

Can somebody tell me why this isn't working and a possible fix, Thanks.

TutorialMan7727 commented 4 months ago

It turns out I'm missing a bunch of files

aragubas commented 3 weeks ago

It turns out I'm missing a bunch of files

What files were you missing? I'm having this same issue on Windows 11 24H2