Emanuil Rusev
Emanuil Rusev

Reputation: 35235

Is it wrong to backup a MySQL DB through copying its data files (.frm, .MYD, etc.)?

I read somewhere that it is, so I was wondering.

Upvotes: 1

Views: 236

Answers (3)

Elemental
Elemental

Reputation: 7491

A slightly more detailed response at askers request.

Some details of the dangers of a straight file copy:

  • If the database is live the database might change some of the files before others so when you copy them you copy them you may get copies in that are inconsistent with each other. If the database is offline this method is probably reliable.

Advantages of using the documented methods:

  • Should work on future version of DBMS
  • Should work consistently across underlying engines
  • Always a consistent snapshot like copy

Upvotes: 0

glglgl
glglgl

Reputation: 91049

It might or might not work, depending on the state of the data.

it should work if you stop the database completely and restart it again after the backup, but there you have a downtime.

Upvotes: 1

coder4
coder4

Reputation: 319

Don't do that, the .frm/.myd/.myi may be much larger than the actual data and may cause crash (data not consistence) or very hard to transfrom/recover.

Use mysqldump to transfer MySQL database.

Upvotes: 1

Related Questions