SysAdmin

MySQL-Diff – Compare two MySQL databases

JJ
Jobin Joseph · Founder and CEO
·Published 16 November 2012·1 min read

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 Documentation

Jobin Joseph
Jobin Joseph, Founder and CEO
5x AWS Certified, ISO 27001:2022 Lead Implementer, 17+ years building cloud infrastructure for regulated industries.
About Jobin →

Reading this because your AWS bill or uptime is a problem?

30 minutes, direct with the founder, no sales pitch: one specific recommendation for your AWS workload.

Book a free 30-minute review
30 min Free Consultation →