mysqldiff命令
首先安装软件包,在centos6.5上面
yum install mysql-utilities
安装好以后
mysqldiff --server1='用户名:密码@mysql服务器地址' --server2='用户名:密码@mysql服务器地址' 数据库名:数据库名 --force
结果:
[root@node1 ~]# mysqldiff --server1='root:123456@node2' --server2='root:123456@localhost' jiaowu:jiaowu --force # server1 on node2: ... connected. # server2 on localhost: ... connected. # WARNING: Objects in server2.jiaowu but not in server1.jiaowu: # TABLE: hat_city # Comparing `jiaowu` to `jiaowu` [FAIL] # Object definitions differ. (--changes-for=server1) # --- `jiaowu` +++ `jiaowu` @@ -1,1 +1,1 @@ -CREATE DATABASE `jiaowu` /*!40100 DEFAULT CHARACTER SET latin1 */ +CREATE DATABASE `jiaowu` /*!40100 DEFAULT CHARACTER SET utf8 */ # Comparing `jiaowu`.`courses` to `jiaowu`.`courses` [PASS] # Comparing `jiaowu`.`hat_area` to `jiaowu`.`hat_area` [FAIL] # Object definitions differ. (--changes-for=server1) # --- `jiaowu`.`hat_area` +++ `jiaowu`.`hat_area` @@ -1,7 +1,7 @@ CREATE TABLE `hat_area` ( `id` int(11) NOT NULL, `areaID` varchar(50) DEFAULT NULL, - `AREA` varchar(100) DEFAULT NULL, + `AREA` varchar(60) DEFAULT NULL, `father` varchar(6) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 # Comparing `jiaowu`.`hat_province` to `jiaowu`.`hat_province` [PASS] # Comparing `jiaowu`.`scores` to `jiaowu`.`scores` [PASS] # Comparing `jiaowu`.`students` to `jiaowu`.`students` [PASS] # Comparing `jiaowu`.`tutors` to `jiaowu`.`tutors` [PASS] Compare failed. One or more differences found.
结果的显示方式跟diff的uniform的显示方式是一样的。