发生环境
mysql for rails (2.8.1)
rails (2.2.2)
ruby 1.8.6
mysql (5.1.29-rc-win32)
问题描述
MySql数据库可以连接,并且与MySql相关的rails配置都正常。
但是在程序运行访问数据库时,服务器出现了如下的错误信息:
ArgumentError (NULL pointer given):
(eval):3:in `each_hash'
(eval):3:in `all_hashes'
....
或者
在rials工程目录下执行rake db:migrate --trace命令导入数据库结构时,发生如下的错误:
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=I
nnoDB
解决方案
Copy libmysql.dll from InstantRails (see below) to your mysql directory (your mysql directory\bin\) and system32 directory(C:\WINDOWS\system32).
Restart your computer and it should be working.
InstantRails libmysql.dll:
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/
或者见附件(libmySQL.rar)
本文描述了在使用Rails 2.2.2和MySQLforRails 2.8.1进行数据库操作时出现的ArgumentError及Mysql::Error错误。通过复制libmysql.dll文件到MySQL目录及系统32目录并重启计算机解决了这一问题。
171

被折叠的 条评论
为什么被折叠?



