I am trying to compare two local databases using the mysqldbcompare utility. The check always shows database consistency check fails. I have tried check and repair command. But to no avail.

I have used the following code and get

C:\Program Files\MySQL\MySQL Workbench CE 5.2.47\utilities>mysqldbcompare --s
erver1=root@localhost --server2=root@localhost ebookshop:ebookpub --run-all-tests

# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
# Checking databases ebookshop on server1 and ebookpub on server2
#
# Object definitions differ. (--changes-for=server1)
#

--- ebookshop
+++ ebookpub
@@ -1,1 +1,1 @@
-CREATE DATABASE `ebookshop` /*!40100 DEFAULT CHARACTER SET latin1 */
+CREATE DATABASE `ebookpub` /*!40100 DEFAULT CHARACTER SET latin1 */

# WARNING: Objects in server1.ebookshop but not in server1.ebookpub:
#        TABLE: books
#
# WARNING: Objects in server1.ebookpub but not in server1.ebookshop:
#        TABLE: books1
#
#                                                   Defn    Row     Data
# Type      Object Name                             Diff    Count   Check
# -------------------------------------------------------------------------

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

I am fairly new to this area. Help is really appreciated.

有帮助吗?

解决方案

It's failing because there are differences in your databases.

  1. One's named ebookpub and ebookshop respectively.
  2. ebookshop has table books; ebookpub has book1

Basically it's working as you'd expect. So "failed" isn't a bad thing.

And you're appropriately using the flag --run-all-tests so, it will show you all failures without stopping at the first one.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top