4

In a Virtual Box VM I had CentOS 7 server installed in a VDI HDD and for some reason “Something I did obviously…” I cant boot the machine with the messages bad magic number you need load the kernel

First, I have tried some things like clean the system with xfs_repair and the repair was good but still cant boot it. Try to change the UIDD from Grub to with out successes try to install Grub but at the moment to do chroot the filesystem gets chroot failed to run command /bin/bash

Sadly I have a database which I didn’t recently backup. I can mount the disk, backup all my files but I haven’t figured out how to extract the database from MariaDB, I would like not lose that. Hopefully some one have some idea or know how to do it. Since it’s there right?

1 Answer 1

1

The data for Maria DB is stored in the directory:

/var/db/mysql/

Or:

/var/lib/mysql/

The separate folders in there should match your database name. So copy that whole directory — or just the databases you need — and you have your database data again.

To restore it, just build a new VM with MariaDB in place and once that is done, stop MariaDB and copy your databases into that same /var/db/mysql/ or /var/lib/mysql/ on your new setup.

So if your database name is /var/db/mysql/my_database/or /var/lib/mysql/my_database you then just need to copy my_database/ to the /var/db/mysql/ or /var/lib/mysql/ on your new MariaDB install.

3
  • 1
    There is in /var/lib/mysql Thank You a lot !
    – denn0n
    Mar 19, 2020 at 22:04
  • @denn0n Happy this worked out and you got to learn how DB storage works. Once you understand it’s just a directory of files it makes recovery and migration easier. Mar 19, 2020 at 22:26
  • Right if i knew that a log time ago it would be easier to migrate db's :D
    – denn0n
    Mar 19, 2020 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .