First of all, you should be aware that it is very important which storage engines do you use.
Lets assume that both of your mysql servers have the same version. Then you could use mysqlhotcopy for MyISAM tables. This should be very fast, but this approach is restricted to MyISAM tables. Because mysqlhotcopy copies the files directly, you can very easiely answer your question, if the two DBs are "bit-by-bit" the same, with the aid of diff
.
INNODB is the default storage engine from version 5.5.5. If you use INNODB storage engine the situation looks different. In that case you can't use mysqlhotcopy
and you are left with mysqldump
.
A few things can go wrong if you use mysqldump
. For example, if the database on server#A has a view to an non existent table, mysql tries to create a view to a non existent table on the right side of your pipe and fails. You can avoid an abort in such cases by using the --force
option.
mysql --force ...
I have copied a whole mysql database with mysqldump
and I compared dumps from both servers and found the dumps differes in the timestamps only. This could be a solution for you.
You should also have a look at other options of mysqldump
. For example I think of
--add-drop-database
--add-drop-table
--single-transaction ( for transactional tables only (like INNODB))