Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After having a vps crash, I asked my hosting to give me the dumped file of my drupal database. It is a folder filled with of *.frm *.MYD files of the database tables. I used to restore mydb.sql files thru command line (mysqldupm ...) but I have no idea how I can restore the current folder. Your help is much appreciated.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The best thing you could do would be to ask them to run mysqldump and give you a proper backup file, as this will be more robust to potential versioning issues in both mysql and the host OS. If they're not willing to do this, you can try copying the files they gave you directly to the data directory (e.g., /var/lib/mysql) with the server stopped, then starting the server and GRANTing privileges to appropriate users.

share|improve this answer
1  
Make sure owner and group for the copied directory is mysql (or whatever uid/gid mysqld runs under). –  3molo Dec 29 '10 at 7:33
    
nedm, they have reloaded the vps so it is not likely that I can access to the mydb.sql. Would you please elaborate on this: Shall I make a mydb.sql folder in /var/lib/mysql? –  alfish Dec 29 '10 at 15:57
    
1) Stop MySQL server; 2) if necessary, rename the folder containing the individual table files to however you want the database to be named (e.g. 'drupal'); 3) copy the folder directly into /var/lib/mysql; 4)as @3molo suggests above, set permissions on the folder: as root, run 'chown -R mysql /var/lib/mysql/*'; 5) restart MySQL server; 6) Use GRANT to set permissions to appropriate MySQL users. –  nedm Dec 29 '10 at 19:04
    
@nedam: I followed your instructions and could restore the site. I greatly appreciate your kind help. –  alfish Dec 31 '10 at 4:17
    
Glad I could help @qliq. I suspect you may get get better and faster help from others on future questions if you mark-as-answer/upvote good answers on questions you've asked (including this one ;) –  nedm Jan 1 '11 at 20:09

First make one thing clear, if you want restore mysql database from 'sql' format, you should use "mysql database < backupfile.sql" command.

Since you are having only backup folder, you have only option to replace the current database folder which resides in "/var/lib/mysql/" by backup folder.

Also permissions of folder should set to mysql.

I have given the model steps below.

Situation :

You have drupal database folder name "drupal"

This folder is present inside "/var/lib/mysql/". So use the below commands

Login your server

$ cd /var/lib/mysql $ mv drupal drupal.bak

Now restore the folder with the name drupal here and apply appropriate permissions by

$ chown mysql.mysql drupal

You can then access your database and let me know if the problem still lies..

Regards, S.Ragavendra Ganesh

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.