MySQL utility "mysqldiff": Database name difference alone? -
i used use adam spiers' mysqldiff tool, hasn't been maintained in many years, on new server i'm trying mysql-utilities package, contains similar tool. when compare 2 databases have exact same schema, fact names different (duh!) enough make tool compare failed (which seems awfully strong word finding differences, guess that's how works). here output:
[root](22:05:48)[~]$ mysqldiff --server1=root:mypassword@localhost kizuna_master:kizuna_misa # server1 on localhost: ... connected. # comparing `kizuna_master` `kizuna_misa` [fail] # object definitions differ. (--changes-for=server1) # --- `kizuna_master` +++ `kizuna_misa` @@ -1 +1 @@ -create database `kizuna_master` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ +create database `kizuna_misa` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ compare failed. 1 or more differences found.
in case, fail if comparing 2 databases on same server - doesn't make sense. doing wrong?
edit: solarflare's suggestion, tried mysqldbcompare: mysqldbcompare --skip-row-count --skip-data-check --run-all-tests --server1=root:mypassword@localhost kizuna_master:kizuna_dev
but it's result same mysqldiff wordier. , both commands, not fail on create database
definition, fails on tables have auto-incremented key field! grief - if i'm saying don't want compare data (--skip-data-check), why think want fail because of auto_increment
? here first part of output of above mysqldbcompare
call:
# server1 on localhost: ... connected. # checking databases kizuna_master , kizuna_dev on server1 # # object definitions differ. (--changes-for=server1) # --- `kizuna_master` +++ `kizuna_dev` @@ -1 +1 @@ -create database `kizuna_master` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ +create database `kizuna_dev` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ # defn row data # type object name diff count check # ------------------------------------------------------------------------- # table action fail skip skip # # object definitions differ. (--changes-for=server1) # --- `kizuna_master`.`action` +++ `kizuna_dev`.`action` @@ -9,4 +9,4 @@ key `personid` (`personid`), key `contacttypeid` (`actiontypeid`), constraint `action_ibfk_1` foreign key (`actiontypeid`) references `actiontype` (`actiontypeid`) -) engine=innodb default charset=utf8mb4 collate=utf8mb4_unicode_ci +) engine=innodb auto_increment=1953 default charset=utf8mb4 collate=utf8mb4_unicode_ci # table actiontype fail skip skip # # object definitions differ. (--changes-for=server1) # --- `kizuna_master`.`actiontype` +++ `kizuna_dev`.`actiontype` @@ -4,4 +4,4 @@ `bgcolor` char(6) character set ascii collate ascii_bin not null default 'ffffff', `template` text collate utf8mb4_unicode_ci not null default '', primary key (`actiontypeid`) -) engine=innodb default charset=utf8mb4 collate=utf8mb4_unicode_ci +) engine=innodb auto_increment=22 default charset=utf8mb4 collate=utf8mb4_unicode_ci # table addrprint pass skip skip # table attendance pass skip skip # table category fail skip skip # # object definitions differ. (--changes-for=server1) # --- `kizuna_master`.`category` +++ `kizuna_dev`.`category` @@ -4,4 +4,4 @@ `usefor` enum('op','p','o') character set ascii collate ascii_bin not null default 'op' comment 'whether category can used people, orgs, or both', primary key (`categoryid`), key `category` (`category`) -) engine=innodb default charset=utf8mb4 collate=utf8mb4_unicode_ci +) engine=innodb auto_increment=101 default charset=utf8mb4 collate=utf8mb4_unicode_ci
etc... whole thing that.
edit #2: adding --skip-table-options
got quiet auto-increment, although don't know other differences option ignore , whether care. although still reports database name difference, doesn't use word "fail" anymore, guess improvement. here output of mysqldbcompare --skip-row-count --skip-data-check --run-all-tests --skip-table-options --difftype=differ --server1=root:mypassword@localhost kizuna_master:kizuna_dev
:
# server1 on localhost: ... connected. # checking databases kizuna_master , kizuna_dev on server1 # # object definitions differ. (--changes-for=server1) # - create database `kizuna_master` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ ? ^^^^ ^ + create database `kizuna_dev` /*!40100 default character set utf8mb4 collate utf8mb4_unicode_ci */ ? ^ ^ # defn row data # type object name diff count check # ------------------------------------------------------------------------- # table action pass skip skip # table actiontype pass skip skip # table addrprint pass skip skip # table attendance pass skip skip # table category pass skip skip # table config pass skip skip # table custom pass skip skip # table donation pass skip skip # table donationtype pass skip skip # table event pass skip skip # table household pass skip skip # table labelprint pass skip skip # table loginlog pass skip skip # table output pass skip skip # table outputset pass skip skip # table percat pass skip skip # table perorg pass skip skip # table person pass skip skip # table photoprint pass skip skip # table pledge pass skip skip # table postalcode pass skip skip # table preselect pass skip skip # table upload pass skip skip # table uploadtype pass skip skip # table user pass skip skip # databases consistent given skip options specified. # # ...done
so guess in bash script pipe grep , check word "fail". mess - old mysqldiff
tool simple , clear.
one other question tool version. mysqldiff --help
says: "mysql utilities mysqldiff version 1.3.6 (part of mysql workbench distribution 5.2.47)". downloaded newest 1 directly, wouldn't install - yum can give me on centos7. database mariadb 10.2.8, if matters. (it 10.2.4 when started discussion, updated since then.)
Comments
Post a Comment