Adam Spiers > MySQL-Diff > mysqldiff

Download:
MySQL-Diff-0.43.tar.gz

Annotate this POD

Website

CPAN RT

New  7
Open  10
View/Report Bugs
Source  

NAME ^

mysqldiff - compare MySQL database schemas

SYNOPSIS ^

  mysqldiff [B<options>] B<database1> B<database2>

  mysqldiff --help

DESCRIPTION ^

mysqldiff is a Perl script front-end to the CPAN module MySQL::Diff which compares the data structures (i.e. schema / table definitions) of two MySQL databases, and returns the differences as a sequence of MySQL commands suitable for piping into mysql which will transform the structure of the first database to be identical to that of the second (c.f. diff and patch).

Database structures can be compared whether they are files containing table definitions or existing databases, local or remote.

N.B. The program makes no attempt to compare any of the data which may be stored in the databases. It is purely for comparing the table definitions. I have no plans to implement data comparison; it is a complex problem and I have no need of such functionality anyway. However there is another program coldiff which does this, and is based on an older program called datadiff which seems to have vanished off the 'net.

For PostgreSQL there are similar tools such as pgdiff and apgdiff.

EXAMPLES ^

  # compare table definitions in two files
  mysqldiff db1.mysql db2.mysql

  # compare table definitions in a file 'db1.mysql' with a database 'db2'
  mysqldiff db1.mysql 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 'foo' with a
  # database 'bar' on a remote machine, when a file foo already
  # exists in the current directory
  mysqldiff --host2=remote.host.com --password=secret db:foo bar

OPTIONS ^

More details to come; for now run mysqldiff --help.

INTERNALS ^

For both of the database structures being compared, the following happens:

BUGS, DEVELOPMENT, CONTRIBUTING ^

See http://software.adamspiers.org/wiki/mysqldiff.

COPYRIGHT AND LICENSE ^

Copyright (c) 2000-2011 Adam Spiers. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

MySQL::Diff, MySQL::Diff::Database, MySQL::Diff::Table, MySQL::Diff::Utils, mysql, mysqldump, mysqlshow

AUTHOR ^

Adam Spiers <mysqldiff@adamspiers.org>

syntax highlighting: