Restore Mysql Databases from hard copies.

  • rebrain
  • 11/02/08
  • Offline
Posted: Thu, 2008-12-18 14:17

Good day,

my root server has gone offline and i needed to make a reinstall of the system some days ago. But as I said the server was offline and I could not make a backup through Webmin.

I had an FTP Account Setup that I was able to reach. I made a copy of the "var\lib\mysql" folder hoping to be able to just copy the contents to the new machine and have the mysql databases as i had them before. Although this is not the case. I am trying to copy in all possible ways but I does not seem right.

My backup database contains one more table then the one that is made after a clean install of the php script. When I restore the backup through root ssh connection Virtualmin shows me an error that the table does not exist (the one that was not there before).

This leads to a question: Where is the information about mysql saved?

Regards, Rebrain

P.S. I have an 'almost' default Virtualmin set installed on a clean Debian Etch Server.


Re:Restore Mysql Databases from hard copies.

  • Joe
  • 10/23/08
  • Offline
  • Thu, 2008-12-18 14:43

Copying the raw data files from one MySQL version to another will never work--identical versions, maybe. But the recommended way to transfer databases is always a dump of the database using the mysqldump command. Webmin, of course, can do this for you, but since you don't have access to Webmin, you'll need to do it from the command line. Here's the docs:

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

If you only have FTP access, you might be out of luck, unless you know exactly which version of MySQL you have on the old system, and can setup an identical installation somewhere so the raw data will work.


Re:Restore Mysql Databases from hard copies.

  • rebrain
  • 11/02/08
  • Offline
  • Fri, 2008-12-19 04:01

Right now I only have the backed up version. Could there be any converter out there that can convert from raw files to sql?

Bummer...


Re:Restore Mysql Databases from hard copies.

  • Joe
  • 10/23/08
  • Offline
  • Fri, 2008-12-19 04:04

As I mentioned, if you can exactly replicate the version and build of MySQL that was on the other machine, it will be able to read the files--this can be pretty easy to accomplish if you know what OS and version the system was running, and what MySQL version (assuming MySQL was installed from OS-standard packages). Otherwise, you will need a dump. I am, by no means, an expert on MySQL. I just dump all of ours every night, so we always have backups that I know I can restore anywhere. But, that's always been my understanding...that if you want to move MySQL data, you have to dump it and then restore it.

You might want to ask on a MySQL forum or mailing list if the data is valuable and there is no way to obtain a dump.


Re:Restore Mysql Databases from hard copies.

  • rebrain
  • 11/02/08
  • Offline
  • Fri, 2008-12-19 05:33

Thank you very much, you guys are always really helpful on the forum and the answers come very fast!

Happy holidays and thanks again! ;)


Yes, its an old post, but...

  • chencho
  • 09/21/11
  • Offline
  • Wed, 2012-05-09 03:56

Yes, its an old post, but... had you recovered yor sites? I'm in the same situation


What Joe said way back then

  • Locutus
  • 10/10/10
  • Offline
  • Wed, 2012-05-09 04:18

What Joe said way back then is still valid. You very probably need an identical version of MySQL to get binary data files to work. For further help, you'd need to specify what exactly the problem is.

Oh, and there is no "converter" that extracts dump files from binary data. Well, that converter would be the MySQL server itself actually. :)