Unix Technical Forum

Backup MySQL databases from hard disk without running instance

This is a discussion on Backup MySQL databases from hard disk without running instance within the MySQL forums, part of the Database Server Software category; --> Hi all, My server crashed recently and I now only have access to the hard disk. This means that ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 10:24 AM
Dan Soendergaard
 
Posts: n/a
Default Backup MySQL databases from hard disk without running instance

Hi all,

My server crashed recently and I now only have access to the hard
disk. This means that I can't do a MySQL dump to backup my data. Can I
still backup my data, if yes, how?

Thanks in advance!

Dan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 10:25 AM
Willem Bogaerts
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

> My server crashed recently and I now only have access to the hard
> disk. This means that I can't do a MySQL dump to backup my data. Can I
> still backup my data, if yes, how?


Under Windows, I found that you can copy the old tables (data directory)
to a fresh MySQL installation and just continue working with it.

Best regards
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 10:25 AM
Dan Soendergaard
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

On Mar 16, 11:04 am, Willem Bogaerts
<w.bogae...@kratz.maardanzonderditstuk.nl> wrote:
> > My server crashed recently and I now only have access to the hard
> > disk. This means that I can't do a MySQL dump to backup my data. Can I
> > still backup my data, if yes, how?

>
> Under Windows, I found that you can copy the old tables (data directory)
> to a fresh MySQL installation and just continue working with it.
>
> Best regards
> --
> Willem Bogaerts
>
> Application smith
> Kratz B.V.http://www.kratz.nl/


I just tried what you suggested, and it didn't work really. The
databases show up, and when I use SHOW TABLES, the tables are also
shown. But as soon as I try to see the content of them (SELECT * FROM
mytable), it tells me that the tables doesn't exist.

Any fixes for this?

Thanks again,

Dan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 10:25 AM
Axel Schwenke
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

"Dan Soendergaard" <dan1990@gmail.com> wrote:
> On Mar 16, 11:04 am, Willem Bogaerts
>>
>> Under Windows, I found that you can copy the old tables (data directory)
>> to a fresh MySQL installation and just continue working with it.


This works for all operating systems, not just Windows.

> I just tried what you suggested, and it didn't work really. The
> databases show up, and when I use SHOW TABLES, the tables are also
> shown. But as soon as I try to see the content of them (SELECT * FROM
> mytable), it tells me that the tables doesn't exist.


Seems the tables are InnoDB tables and you did not copy the InnoDB
tablespace files (and logs) as well.


XL
--
Axel Schwenke, Support Engineer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 10:25 AM
Dan Soendergaard
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

On Mar 16, 11:33 am, Axel Schwenke <axel.schwe...@gmx.de> wrote:
> "Dan Soendergaard" <dan1...@gmail.com> wrote:
> > On Mar 16, 11:04 am, Willem Bogaerts

>
> >> Under Windows, I found that you can copy the old tables (data directory)
> >> to a fresh MySQL installation and just continue working with it.

>
> This works for all operating systems, not just Windows.
>
> > I just tried what you suggested, and it didn't work really. The
> > databases show up, and when I use SHOW TABLES, the tables are also
> > shown. But as soon as I try to see the content of them (SELECT * FROM
> > mytable), it tells me that the tables doesn't exist.

>
> Seems the tables are InnoDB tables and you did not copy the InnoDB
> tablespace files (and logs) as well.
>
> XL
> --
> Axel Schwenke, Support Engineer, MySQL AB
>
> Online User Manual:http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/


The tables are InnoDB, yes. I located a directory called "InnoDB" in
the MySQL directory. It contained one file which I copied to the new
MySQL installation. I then copied the whole "Data" directory to the
new installation too, but I get the same result. Are the InnoDB
tablespace files and logs located somewhere else? Should I copy
anything else to get it to work?

Dan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 10:25 AM
Axel Schwenke
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

"Dan Soendergaard" <dan1990@gmail.com> wrote:
> On Mar 16, 11:33 am, Axel Schwenke <axel.schwe...@gmx.de> wrote:
>>
>> Seems the tables are InnoDB tables and you did not copy the InnoDB
>> tablespace files (and logs) as well.

>
> The tables are InnoDB, yes. I located a directory called "InnoDB" in
> the MySQL directory. It contained one file which I copied to the new
> MySQL installation. I then copied the whole "Data" directory to the
> new installation too, but I get the same result. Are the InnoDB
> tablespace files and logs located somewhere else? Should I copy
> anything else to get it to work?


This is all configurable. Get the my.ini file from the old installation
and check the innodb_data_home_dir, innodb_data_file_path and
innodb_log_group_home_dir variables for where to find the data files
and logs. If there are nonstandard settings in my.ini, you have to copy
them to the new my.ini.

Default is to have none of those settings in my.ini. Then everything is
located in datadir = $INSTALLDIR/Data. There should be files ibdata1,
ib_logfile0 and ib_logfile1.

Oh - and use the *exact* same version of MySQL.


XL
--
Axel Schwenke, Support Engineer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 10:25 AM
Dan Soendergaard
 
Posts: n/a
Default Re: Backup MySQL databases from hard disk without running instance

On Mar 16, 12:44 pm, Axel Schwenke <axel.schwe...@gmx.de> wrote:
> "Dan Soendergaard" <dan1...@gmail.com> wrote:
> > On Mar 16, 11:33 am, Axel Schwenke <axel.schwe...@gmx.de> wrote:

>
> >> Seems the tables are InnoDB tables and you did not copy the InnoDB
> >> tablespace files (and logs) as well.

>
> > The tables are InnoDB, yes. I located a directory called "InnoDB" in
> > the MySQL directory. It contained one file which I copied to the new
> > MySQL installation. I then copied the whole "Data" directory to the
> > new installation too, but I get the same result. Are the InnoDB
> > tablespace files and logs located somewhere else? Should I copy
> > anything else to get it to work?

>
> This is all configurable. Get the my.ini file from the old installation
> and check the innodb_data_home_dir, innodb_data_file_path and
> innodb_log_group_home_dir variables for where to find the data files
> and logs. If there are nonstandard settings in my.ini, you have to copy
> them to the new my.ini.
>
> Default is to have none of those settings in my.ini. Then everything is
> located in datadir = $INSTALLDIR/Data. There should be files ibdata1,
> ib_logfile0 and ib_logfile1.
>
> Oh - and use the *exact* same version of MySQL.
>
> XL
> --
> Axel Schwenke, Support Engineer, MySQL AB
>
> Online User Manual:http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/


Got it to work now, incredible! I guess it was because I had
downloaded the most recent version of MySQL.

Thank you a lot to both of you!

Regards,

Dan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:27 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com