程式狂想筆記

一個攻城師奮鬥史

0%

MySQL 比較兩個資料庫方法

先留者,有空再實作看看

Red-Gate’s MySQL Schema & Data Compare (Commercial)
Maatkit (now Percona)
liquibase
Toad
Nob Hill Database Compare (Commercial)
MySQL Diff
SQL EDT (Commercial)

Compare two MySQL databases - Stack Overflow
檔案收發系統 - IT閱讀

2019-10-07
聽說可以 table 比對 table 產生 sql 語法
查了一下還真的有!!
(1) How to Compare two Databases using MySQL Workbench - YouTube
(1) mysql compare databases and sync | Mysql tutorial - YouTube
mmatuson/SchemaSync: A MySQL Schema Versioning and Migration Utility
[Mysql] 使用mysqldiff和mysqldbcompare检查数据一致性 | zeven’s blog

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ mysqldbcompare --server1=root:root@localhost --server2=root:root@localhost db1:db2 --changes-for=server1 -a --difftype=sql


# WARNING: Objects in server1.db1 but not in server1.db2:
# TABLE: table2
#
# WARNING: Objects in server1.db2 but not in server1.tb1:
# TABLE: table3
#
# Defn Row Data
# Type Object Name Diff Count Check
#-------------------------------------------------------------------------
# TABLE t1 pass pass -
# - Compare table checksum FAIL
# - Find row differences FAIL
#
# Transformation for --changes-for=server1:
#

# Data differences found among rows:
UPDATE db1.t1 SET b = 'Test 123' WHERE a = '1';
UPDATE db1.t1 SET b = 'Test 789' WHERE a = '3';
DELETE FROM db1.t1 WHERE a = '4';
INSERT INTO db1.t1 (a, b) VALUES('5', 'New row - db2');


# Database consistency check failed.
#
# ...done

mysqldbcompare MySQL数据库比较工具 - 歪麦博客