Reputation: 41
When copying a database is there a difference if you use the myslqdump command or if you copy the database from the data directory in e.g. WIndows 7?
Upvotes: 1
Views: 89
Reputation: 449385
When copying a database is there a difference if you use the myslqdump command or if you copy the database from the data directory in e.g. WIndows 7?
Yup: You should do the former and not the latter. :)
Copying the live data files is probably not a good idea: They could still be open, mySQL could be writing into them right now, their compatibility differs across server versions, platforms, filesystems etc... this should only be done in very special cases (mysqlhotcopy
does something similar, but it has a number of safeguards built in to prevent corruption, and is designed to be a backup tool only).
mysqldump
will create a reliable data dump that can be re-imported anywhere (well, sometimes it's a rough ride and you need to pay attention to version compatibility, but still.) it is the recommended way to copy databases.
Upvotes: 4