当我比较两个数据库时,mysqluc卡在一半,并显示错误如下:
**Traceback (most recent call last):
File "G:\ade\build\sb_0-14553893-1424966082.93\Python-2.7.6-windows-x86-32bit\
lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
File "scripts\mysqldiff.py", line 245, in <module>
File ".\mysql\utilities\command\diff.py", line 149, in database_diff
File ".\mysql\utilities\command\diff.py", line 92, in object_diff
File ".\mysql\utilities\common\dbcompare.py", line 646, in diff_objects
File ".\mysql\utilities\common\dbcompare.py", line 466, in _check_tables_struc
ture
File ".\mysql\utilities\common\database.py", line 1206, in get_object_definiti
on
File ".\mysql\utilities\common\server.py", line 1263, in exec_query
File ".\mysql\connector\cursor.py", line 339, in close
mysql.connector.errors.InternalError: Unread result found.**
我尝试过 mysqldiff 和 mysqldbcompare 命令。
mysqldiff --server1=username:password@hostname:3307 --server2=username:pasword@localhost:3306 DB1:DB1 --force --difftype=sql --changes-for=server2
mysqldbcompare --server1=username:password@hostname:3307 --server2=username:pasword@localhost:3306 DB1:DB1 --run-all-test --difftype=sql changes-for=server2
它在两个命令上都卡住了。
我尝试在 Windows 7、Windows 8.1 上进行比较。
最佳答案
我发现了问题。数据库很大,表中的某些列采用“utf8”字符集,排序规则为“utf8_general_ci”,某些列采用“latin1”,排序规则为“<强>latin1_swedish_ci”排序规则。所以有时它会卡住,我不知道为什么。我将每列的字符集更改为“latin1”,现在它不再卡住了。
执行此查询以检查列的字符集。
SELECT table_name,column_name,character_set_name,data_type FROM information_schema.`COLUMNS`
WHERE table_schema = "DbName"
对于字符集转换,您可以从此链接获取帮助
http://dev.mysql.com/doc/refman/5.7/en/charset-conversion.html
关于python - mysqldbcompare 和 mysqldiff 无法比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31847264/