views:

278

answers:

2

I have a directory only backup of a previous server that hosted multiple sites. I had access to a few .sql backups for our databases, but there were some that had not been backed up in that fashion. I located the .MYD,.frm, and .MYI files for the tables in my db in the var/lib/mysql/db_name directory.

I would like to know if there is a way to get the data from these files and move them into the new existing mysql installation? I tried copying the files from the db folder to a db folder with the exact same name, but I still get a "Can't find db_name/table_name.frm" error when trying to access any of the tables. They do show up in phpmyadmin table list, the error comes up when trying to access the tables.

Is this possible? If so, how do I go about taking these table files and turning them into use-able data?

I am sorry if my question or explanation doesn't make any sense. This is part of an ongoing 11+ hour emergency server recovery project that got sprung on me today, so my brain is fried. I will answer any questions necessary.

+1  A: 

Have you checked that the files in /var/lib/mysql/db_name/ are owned by mysql and not root? Usually copying the files in should 'just work' (certainly it has and does for me). I assume you're using the same or very similar version of MySQL?

Jamie Love
Mysql version is the same. All files are owned by mysql.
Mesidin
I assume further that it's the same system type and that the case of the filenames are all the same as well. Are the DB files actually readable by MySQL (i.e. permissions are r/w for the owner)? MySQL has been restarted?. Have you tried stopping MySQL, copying files in and setting permissions etc, then restarting MySQL?Apart from all these basics, I am out of ideas.
Jamie Love
A: 

You really need to restore everything relating to that database, including also the matching 'mysql' database for your previous installation.

crb
I've never needed to include the mysql database in a copy, but maybe it's important in some circumstances.
Jamie Love