mysqldiff--server1=ecdba:xx@yyyy:3305--server2=ecdba:xx@yyyy:3305mydb1.t_user:mydb2.t_user--changes-for=server2--difftype=sql# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
# Comparing mydb1.t_user to mydb2.t_user [FAIL]
# Transformation for --changes-for=server2:
#
ALTERTABLE`mydb2`.`t_user`DROPINDEXidx_corpid,ADDINDEXidx_corpid_deptid(f_corp_id,f_dept_id),ADDINDEXidx_dept(f_dept_id);# Compare failed. One or more differences found.
这个地方原版里面会将idx_corpid_deptid生成ADDINDEXidx_corpid_deptid(f_corp_id),ADDINDEXidx_corpid_deptid(f_dept_id)。这里已修复
原版:mydb1.t_test1:mydb2.t_test1--changes-for=server2--difftype=sql# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
ERROR:Theobjectmydb2.t_test1doesnotexist.新选项--include-create--include-dropmydb1.t_test1:mydb2.t_test1--changes-for=server2--difftype=sql--include-create--include-drop# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
USEmydb2;CREATETABLE`t_test1`(`id`int(11)DEFAULTNULL)ENGINE=InnoDBDEFAULTCHARSET=utf8mb4';
'# Compare failed. One or more differences found.
新选项,修改changes-for后,生成dropmydb1.t_test1:mydb2.t_test1--changes-for=server1--difftype=sql--include-create--include-drop# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
DROPTABLEIFEXISTSmydb1.t_test1;# Compare failed. One or more differences found.
mydb1.t_user_face:mydb2.t_user_face--changes-for=server2--difftype=sql--include-create--include-drop# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
# Comparing mydb1.t_user_face to mydb2.t_user_face [FAIL]
# Transformation for --changes-for=server2:
#
ALTERTABLE`mydb2`.`t_user_face`DROPINDEXidx_tt2,DROPINDEXidx_corp_time,DROPCOLUMNf_test,ADDINDEXidx_corp_time(f_corp_id,f_modify_time),CHANGECOLUMNf_corp_idf_corp_idint(11)unsignedNOTNULLCOMMENT'企业id',CHANGECOLUMNf_user_idf_user_idint(11)unsignedNOTNULLCOMMENT'用户id',AUTO_INCREMENT=123434,COLLATE=utf8mb4_general_ci;# Compare failed. One or more differences found.
这个地方原版处理idx_corp_time时,因为第一列索引字段相同,会生成ADDINDEXidx_corp_time(f_modify_time)。这里已修复新选项--skip-option-autoincmydb1.t_user_face:mydb2.t_user_face--changes-for=server1--difftype=sql--include-create--include-drop--skip-option-autoinc# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
# Comparing mydb1.t_user_face to mydb2.t_user_face [FAIL]
# Transformation for --changes-for=server1:
#
ALTERTABLE`mydb1`.`t_user_face`DROPINDEXidx_corp_time,ADDUNIQUEINDEXidx_tt2(f_user_id,f_modify_time),ADDINDEXidx_corp_time(f_corp_id),CHANGECOLUMNf_corp_idf_corp_idint(10)unsignedNOTNULLCOMMENT'企业id',CHANGECOLUMNf_user_idf_user_idint(10)unsignedNOTNULLCOMMENT'用户id',ADDCOLUMNf_testvarchar(20)NOTNULLDEFAULT''AFTERf_url,COLLATE=utf8_general_ci;# Compare failed. One or more differences found.
直接指定db,原版预修改版处理相同mydb1:mydb2--changes-for=server2--difftype=sql# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
# WARNING: Objects in server1.mydb1 but not in server1.mydb2:
# TABLE: t_test1
# WARNING: Objects in server1.mydb2 but not in server1.mydb1:
# VIEW: view_test
# TABLE: t_test2
# Compare failed. One or more differences found.
指定db.*,处理相同mydb1.*:mydb2.*--changes-for=server2--difftype=sql# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
ERROR:Theobjectmydb1.*doesnotexist.指定db.*和--include-create,依次处理全部对象,包括过程,视图等mydb1.*:mydb2.*--changes-for=server2--difftype=sql--difftype=sql--include-create--include-drop--skip-option-autoinc# WARNING: Using a password on the command line interface can be insecure.
# server1 on 10.xx.xx.127: ... connected.
# server2 on 10.xx.xx.127: ... connected.
# WARNING: Objects in server1.mydb1 but not in server1.mydb2:
# TABLE: t_test1
# WARNING: Objects in server1.mydb2 but not in server1.mydb1:
# VIEW: view_test
# TABLE: t_test2
# Comparing mydb1.t_user_face to mydb2.t_user_face [FAIL]
# Transformation for --changes-for=server2:
#
ALTERTABLE`mydb2`.`t_user_face`DROPINDEXidx_tt2,DROPINDEXidx_corp_time,DROPCOLUMNf_test,ADDINDEXidx_corp_time(f_corp_id,f_modify_time),CHANGECOLUMNf_corp_idf_corp_idint(11)unsignedNOTNULLCOMMENT'企业id',CHANGECOLUMNf_user_idf_user_idint(11)unsignedNOTNULLCOMMENT'用户id',COLLATE=utf8mb4_general_ci;DROPVIEWIFEXISTSmydb2.view_test;USEmydb2;CREATETABLE`t_test1`(`id`int(11)DEFAULTNULL)ENGINE=InnoDBDEFAULTCHARSET=utf8mb4';
'# Comparing mydb1.t_user to mydb2.t_user [FAIL]
# Transformation for --changes-for=server2:
#
ALTERTABLE`mydb2`.`t_user`DROPINDEXidx_corpid,ADDINDEXidx_corpid_deptid(f_corp_id,f_dept_id),ADDINDEXidx_dept(f_dept_id);# Comparing mydb1.proc_test to mydb2.proc_test [FAIL]
# Transformation for --changes-for=server2:
#
DROPPROCEDUREIFEXISTS`mydb2`.`proc_test`;DELIMITER//CREATEDEFINER=`ecdba`@`%`PROCEDURE`mydb2`.`proc_test`()CONTAINSSQLSQLSECURITYDEFINERBEGINselect1;END//DELIMITER;DROPTABLEIFEXISTSmydb2.t_test2;# Compare failed. One or more differences found.