CentOS - Trying to backup/restore a MySQL database?

2

My CentOS 6 server got a server issue, so customer support took a backup of my server and reinstalled it.

The backup is in a folder called /home/42406.

I'm trying to find my MySQL database called 'mariomansion'.

I installed LAMP and I tried a mysqldump, but it said it couldn't find the database.

I went to /home/42406/var/lib/mysql, and I found two folders: one called mariomansion and one called mysql. The mariomansion folder contains .frm, .myd, and .myi files with the names of the tables.

How do I get my SQL database file back from my backup?

LifeMushroom

Posted 2015-07-24T16:10:53.137

Reputation: 78

Answers

0

Can you copy the mariomansion directory and all its files in /home/42406/var/lib/mysql to /var/lib/mysql? That's where the database files reside on a CentOS system, but you will need root access to /var/lib/mysql to put them there. You can try:

cp --recursive /home/42406/var/lib/mysql/mariomansion /var/lib/mysql/.

If you have root access to the server, you should be able to put the files there yourself; I assume you have root access if you installed a LAMP stack. If not, you may need to get customer support to do that for you.

The owner and group for the directories and their files when placed there should be mysql. You can change the ownership with the following commands if you can copy the directory and its files there.

chown --recursive mysql /var/lib/mysql/mariomansion
chgrp --recursive mysql /var/lib/mysql/mariomansion

The owner of the directory, mysql, should have read, write, and execute access, i.e., rwx, with the "x" allowing the directory owner, in this case mysql, to enter the directory and access files and and any directories inside. You can set the permissions on the directory with chmod 700 /var/lib/mysql/mariomansion. On my CentOS server, all of the files for databases have owner and group access set to read and write, which you can set with chmod 660 /var/lib/mysql/mariomansion/*.

Once you put the files back where MySQL, or MariaDB, if you are using that fork of MySQL instead, expects them, you should be able to access your database again.

moonpoint

Posted 2015-07-24T16:10:53.137

Reputation: 4 432