- 论坛徽章:
- 0
|
mysqldiff
alex@debian:~$ mysql -h rhel -u coldmoon -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use ayu;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [ayu]> desc a;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| x | char(1) | NO | PRI | NULL | |
| y | char(2) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.01 sec)
MariaDB [ayu]> exit
Bye
alex@debian:~$ mysql -h centos -u coldmoon -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use ayu;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [ayu]> desc b;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| x | char(1) | NO | | NULL | |
| y | char(2) | YES | | NULL | |
| z | char(3) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
3 rows in set (0.00 sec)
MariaDB [ayu]> exit
Bye
alex@debian:~$ mysqldiff --server1=coldmoon:123456@rhel --server2=coldmoon:123456@centos --difftype=sql ayu.a:ayu.b
# WARNING: Using a password on the command line interface can be insecure.
# server1 on rhel: ... connected.
# server2 on centos: ... connected.
# Comparing ayu.a to ayu.b [FAIL]
# Transformation for --changes-for=server1:
#
ALTER TABLE `ayu`.`a`
DROP PRIMARY KEY,
ADD COLUMN z char(3) NULL AFTER y;
Compare failed. One or more differences found.
alex@debian:~$
alex@debian:~$
alex@debian:~$
alex@debian:~$ mysqldiff --server1=coldmoon:123456@rhel --server2=coldmoon:123456@centos --difftype=context ayu.a:ayu.b
# WARNING: Using a password on the command line interface can be insecure.
# server1 on rhel: ... connected.
# server2 on centos: ... connected.
# Comparing ayu.a to ayu.b [FAIL]
# Object definitions differ. (--changes-for=server1)
#
*** ayu.a
--- ayu.b
***************
*** 1,5 ****
! CREATE TABLE `a` (
`x` char(1) NOT NULL,
`y` char(2) DEFAULT NULL,
! PRIMARY KEY (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
--- 1,5 ----
! CREATE TABLE `b` (
`x` char(1) NOT NULL,
`y` char(2) DEFAULT NULL,
! `z` char(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Compare failed. One or more differences found.
|
|