MySQL database files location

Hello,

I had a VM with apache and mysql installed and databases. Due to unforseen circumstances i had to rebuild the VM. The original / drive now is mounted on another VM as a disk. I would love to take my databases from there. I cannot find anywhere were the database files are located so i can move them. on the internet it mentions /var/lib/mysql but this folder is empty.

Anyone knows where in Leap they are?

thank you

MySQL’s (and also MariaDB’s) database files are in /var/lib/mysql/, unless configured manually otherwise.

But note that the folder and the files have to be owned by (and read-/writeable for) the user mysql, or it won’t be able to access them.

check the file “/etc/my.cnf”. If that contains a definition like “datadir = PATH_TO_YOUR_DATABASE” you will find the database files under “PATH_TO_YOUR_DATABASE” otherwise the default is used (which is “/var/lib/mysql”). To make sure you have sufficient rights to see/move the database files, you should look for them as “root”.

Best regards

susejunky

If you look in /var/lib/mysql on the other VM, and that folder’s empty, this just means that VM is not running mysql at all. You have to look beyond the mountpoint where you mounted the original VM as a disk. Your databases should be in MOUNTPOINT/var/lib/mysql

Hello,

I solved the issue. actually the files were really not there. Thank me that i keep backups!