mysqldbcompare和mysqldiff无法比较

时间:2015-08-06 05:10:24

标签: python mysql mysql-python

当我比较两个数据库时,mysqluc中途停留并显示错误如下:

class MyController extends BaseController {

    public function __construct()
    {
        if ((time() - Session::activity()) > (Config::get('session.lifetime') * 60))
        {
            // Session expired
        }
    }

}

我尝试过mysqldiff和mysqldbcompare命令。

**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.**

这两个命令都被卡住了。

我试图在Windows 7,Windows 8.1上进行比较。

1 个答案:

答案 0 :(得分:0)

我发现了问题。数据库很大,表中的一些列位于&#34; utf8 &#34;字符集&#34; utf8_general_ci &#34;整理和一些&#34; latin1 &#34;与&#34; latin1_swedish_ci &#34;排序规则。所以有时它会卡住我不知道为什么。我将每列的字符集更改为&#34; latin1&#34;现在它不会卡住。

执行此查询以检查列的字符集。

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