MySQL Utilities mysqldbcompare


Need to copy a database from another server to another and make certain that the two are identical? The previous blog entry was a quick into to mysqldbcopy from the MySQL Utilities. This time we use mysqldbcompare to double check on the database we just copied. This is a very quick way to copy a database from a master to a slave or from production to a test server.

$ mysqldbcopy --force --source=root@10.0.0.18 --destination=root@@localhost davestuff:davestuff
# Source on 10.0.0.18: ... connected.
# Destination on localhost: ... connected.
# Copying database davestuff renamed as davestuff
# Copying TABLE davestuff.a
# Copying GRANTS from davestuff
# Copying data for TABLE davestuff.a
#...done.
$mysqldbcompare -a --server1=root@10.0.0.18 --server2=root@localhost davestuff:davestuff
# server1 on 10.0.0.18: ... connected.
# server2 on localhost: ... connected.
# Checking databases davestuff on server1 and davestuff on server2
#
# Defn Row Data
# Type Object Name Diff Count Check
# -------------------------------------------------------------------------
# TABLE a pass pass pass

Databases are consistent.
#
# ...done

About these ads

Leave a comment

Filed under Basics, MySQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s