1

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

Emanuil Rusev
  • 34,563
  • 55
  • 137
  • 201
  • 1
    possible duplicate of [Is copying /var/lib/mysql a good alterntive to mysqldump?](http://stackoverflow.com/questions/2482491/is-copying-var-lib-mysql-a-good-alterntive-to-mysqldump) – Matteo Riva Aug 27 '11 at 06:55

3 Answers3

1

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.

coder4
  • 319
  • 2
  • 4
  • Where could the data inconsistency come from? If the same data files produced consistent data in one server, why wouldn't they produce consistent data in another? – Emanuil Rusev Aug 27 '11 at 06:24
  • 2
    @Emanuil 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 but not future versions of MySQL proof. – Elemental Aug 27 '11 at 06:42
  • @Elemental, Thanks! You should have written that as a separate answer I can set it as my accepted answer. – Emanuil Rusev Aug 27 '11 at 08:46
1

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.

glglgl
  • 89,107
  • 13
  • 149
  • 217
0

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
Elemental
  • 7,365
  • 2
  • 28
  • 33