Home > Software engineering >  Moved mountpoint of MariaDB in docker, now databases gone
Moved mountpoint of MariaDB in docker, now databases gone

Time:12-24

Ok I did a dumb thing, I wanted to rename the local database file that was a mount point for my database, but now when starting the container it shows no databases.

  mariadb:
    container_name: mariadb
    image: mariadb:10.2
    environment:
     - MYSQL_ROOT_PASSWORD=test1234
    volumes:
     - <myhomedir>/mariakn:/var/lib/mysql

I changed the database folder in the <myhomedir>/mariakn by using a sudo mv mariakn mariadb. Then when the new container didn't show any databases, I moved it back, undid the change in docker-compose.

Databases still won't show, but the files are still there in the folder..what can I do to get it back to normal?

CodePudding user response:

First, you MUST make a copy of the files as backup. Then try docker-compose up --force-recreate. Check in mariadb log docker-compose logs mariadb -f for any database error, or, your database files already corrupted before?

  • Related