MySQL-Diff – Compare two MySQL databases

16. November 2012 SysAdmin 0

**MySQL-Diff** is a tool purely for comparing the mysql table definitions. The program makes no attempt to compare any of the data which may be stored in the databases.

### **Installation**

“Automatic” installation via CPANPLUS.pm or CPAN.pm
==========================================

Installation from either of the recommended installers can be performed at the
command line, with either of the two following commands:

`$ perl -MCPANPLUS -e ‘install MySQL::Diff’`

or

`$ perl -MCPAN -e ‘install MySQL::Diff’`

Although CPAN.pm is the default installer for many, with the release of Perl
5.10, CPANPLUS.pm is now also available in core. However, if you use an earlier
version of Perl, you can install CPANPLUS from the CPAN with the following
command:

`$ perl -MCPAN -e ‘install CPANPLUS’`

### **Usage**

– Compare table definitions in two files

`mysqldiff db1.sql db2.sql`

– Compare table definitions in a file ‘db1.mysql’ with a database ‘db2′

`mysqldiff db1.sql db2`

– Interactively upgrade schema of database ‘db1′ to be like the schema described in the file ‘db2.mysql’

`mysqldiff -A db1 db2.mysql`

– Compare table definitions in two databases on a remote machine

`mysqldiff –host=remote.host.com –user=myaccount db1 db2`

– Compare table definitions in a local database ‘db1′ with a database ‘db2′ on a remote machine, when a file ‘db1′ already exists in the current directory

`mysqldiff –host2=remote.host.com –password=secret db:db1 db2`

**Details.**

[Project URL](http://search.cpan.org/~aspiers/MySQL-Diff-0.42/ “Project URL”) [Documentation](http://search.cpan.org/~aspiers/MySQL-Diff-0.42/bin/mysqldiff “Documentation”)


Leave a Reply

Your email address will not be published.