您的位置:首页 > 数据库 > MySQL

Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES解决方案

2009-07-02 17:22 861 查看
ROR在迁移数据库时,出现如下错误:

rake aborted!Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES

跟踪错误:
在mysql_adapter.rb里面找到SHOW TABLES

def tables(name = nil) #:nodoc:
tables = []
execute("SHOW TABLES", name).each { |field| tables << field[0] }
tables
end

在你将数据库执行清除为0版本时,又会出现 each的错误,非常麻烦。

--------------------------------------------
gem list --local
得到:mysql 2.7.3

安装的的mysql客户端为5.1
C:\Program Files\MySQL\MySQL Server 5.1\bin
mysql Ver 14.14 Distrib 5.1.30b, for Win32 (ia32)

--------------------------------------------
解决方案:

最简单的办法:直接重新安装5.0版本的mysql,一切恢复正常。

如果不能卸载现有的mysql,你可以找一个低版本的mysql,寻得其mysql/bin/目录下的扩展文件libmySQL,然后将其copy到ruby/bin,或许能解决问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐