- 浏览: 223912 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
Breather.杨:
斯库伊!受教
基于按annotation的hibernate主键生成策略 -
w420372197:
很详细,学习中..转载了
基于按annotation的hibernate主键生成策略 -
wslovenide:
...
基于按annotation的hibernate主键生成策略 -
Navee:
写的十分详细!感谢
基于按annotation的hibernate主键生成策略 -
eric.cheng:
很好,学习了
基于按annotation的hibernate主键生成策略
Rails2.2.2上gem install mysql
环境:WindowsXP RadRails ruby1.8.2 rails2.2.2 mysql5.1.30
google一下,发现Rails2.2.2库不包括mysql适配器,需要自己安装。
第一尝试,直接运行
gem install mysql
发现公司网络有代理,无法远程安装,本地安装又没找到相应的gem库,只好接着试。
接着,尝试安装mysql的jdbc适配器。
先从http://gems.rubyforge.vm.bytemark.co.uk/gems/上下载
activerecord-jdbc-adapter-0.9.gem ,
activerecord-jdbcmysql-adapter-0.9.gem 。
运行
gem install E:\study\Ruby_on_Rails\ruby-gems\activerecord-jdbcmysql-adapter-0.9.gem gem install E:\study\Ruby_on_Rails\ruby-gems\activerecord-jdbc-adapter-0.9.gem gem install E:\study\Ruby_on_Rails\ruby-gems\jdbc-mysql-5.0.4.gem
安装信息
>gem install E:\study\Ruby_on_Rails\ruby-gems\jdbc-mysql-5.0.4.gem
Successfully installed jdbc-mysql-5.0.4
1 gem installed
Installing ri documentation for jdbc-mysql-5.0.4...
Installing RDoc documentation for jdbc-mysql-5.0.4...
>gem install E:\study\Ruby_on_Rails\ruby-gems\jdbc-mysql-5.0.4.gem
Successfully installed jdbc-mysql-5.0.4
1 gem installed
Installing ri documentation for jdbc-mysql-5.0.4...
Installing RDoc documentation for jdbc-mysql-5.0.4...
>gem install E:\study\Ruby_on_Rails\ruby-gems\activerecord-jdbcmysql-adapter-0.9.gem
Successfully installed activerecord-jdbcmysql-adapter-0.9
1 gem installed
Installing ri documentation for activerecord-jdbcmysql-adapter-0.9...
Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.9...
运行
rake db:migrate
错误消息
>rake db:migrate
(in E:/workspace/studyRails)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
(See full trace by running task with --trace)
>
根据提示,开启trace,运行
rake db:migrate --trace
>rake db:migrate --trace
rake db:migrate --trace
(in E:/workspace/studyRails)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- jdbc-mysql-5.0.4/lib/jdbc/mysql.rb
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:64:in `mysql_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:121:in `retrieve_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:113:in `connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:429:in `initialize'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:394:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:394:in `up'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:377:in `migrate'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:111
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
>
注意这一行
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:64:in `mysql_connection'
跟mysql配置有关系,根据进去,发现
# Require the MySQL driver and define Mysql::Result.all_hashes unless defined? Mysql begin require_library_or_gem('mysql') rescue LoadError $stderr.puts '!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.' raise end end MysqlCompat.define_all_hashes_method!
上面的
require_library_or_gem('mysql')
装载mysql.rb时失败。
接着,根据安装的mysql的jdbc适配器的目录修改mysql_adapter.rb中第63行
require_library_or_gem('mysql')
修改为
require 'jdbc/mysql'
继续运行
rake db:migrate --trace
出现错误信息 Mysql not loaded,至此好像进入死胡同。打开C:\Ruby\lib\ruby\gems\1.8\gems\jdbc-mysql-5.0.4\lib\jdbc\mysql.rb
module Jdbc module MySQL VERSION = "5.0.4" end end if RUBY_PLATFORM =~ /java/ require "mysql-connector-java-#{Jdbc::MySQL::VERSION}-bin.jar" else warn "jdbc-mysql is only for use with JRuby" end
mysql的JDBC适配器中的mysql.rb非常简单,清楚的表明
jdbc-mysql is only for use with JRuby
至此我发现自己一开始就错了,没有搞清楚环境就人云亦云的安装数据库适配器。(这也是网上一些文章的通病,对一些相关的东西交代不清楚,一不小心就着道了)
接着从http://gems.rubyforge.vm.bytemark.co.uk/gems/上下载了新的mysql适配器
extlib-0.9.10.gem
data_objects-0.9.11.gem
do_mysql-0.9.11.gem
继续安装
gem install E:\study\Ruby_on_Rails\ruby-gems\addressable-2.0.2.gem gem install E:\study\Ruby_on_Rails\ruby-gems\extlib-0.9.10.gem gem install E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem gem install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
错误消息
>gem install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: Error installing E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem:
do_mysql requires data_objects (= 0.9.11, runtime)
>gem install E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: Error installing E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem:
data_objects requires addressable (~> 2.0, runtime)
>gem install E:\study\Ruby_on_Rails\ruby-gems\addressable-2.0.2.gem
Successfully installed addressable-2.0.2
1 gem installed
Installing ri documentation for addressable-2.0.2...
Installing RDoc documentation for addressable-2.0.2...
>gem install E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: Error installing E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem:
data_objects requires extlib (~> 0.9.9, runtime)
>gem install E:\study\Ruby_on_Rails\ruby-gems\extlib-0.9.10.gem
>gem install E:\study\Ruby_on_Rails\ruby-gems\extlib-0.9.10.gem
Successfully installed extlib-0.9.10
1 gem installed
>gem install E:\study\Ruby_on_Rails\ruby-gems\data_objects-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
Successfully installed data_objects-0.9.11
1 gem installed
Installing ri documentation for data_objects-0.9.11...
Installing RDoc documentation for data_objects-0.9.11...
>gem install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
Building native extensions. This could take a while...
ERROR: Error installing E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
checking for mysql.h... no
checking for main() in libmysql.lib... no
checking for mysql_query() in mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/do_mysql-0.9.11 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/do_mysql-0.9.11/ext/do_mysql_ext/gem_make.out
>gem install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
Building native extensions. This could take a while...
ERROR: Error installing E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb install E:\study\Ruby_on_Rails\ruby-gems\do_mysql-0.9.11.gem
checking for mysql.h... no
checking for main() in libmysql.lib... no
checking for mysql_query() in mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/do_mysql-0.9.11 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/do_mysql-0.9.11/ext/do_mysql_ext/gem_make.out
在windows下安装do-mysql有点困难。
没办法,只好把电脑带回家,继续第一次尝试。这一次成功了,但是输出
>gem install mysql
Successfully installed mysql-2.7.3-x86-mswin32
1 gem installed
Installing ri documentation for mysql-2.7.3-x86-mswin32...
Installing RDoc documentation for mysql-2.7.3-x86-mswin32...
ERROR: While generating documentation for mysql-2.7.3-x86-mswin32
... MESSAGE: Unhandled special: Special: type=17, text="<!-- $Id: README.html,v 1.20 2006-12-20 05:31:52 tommy Exp $ -->"
... RDOC args: --op C:/Ruby/lib/ruby/gems/1.8/doc/mysql-2.7.3-x86-mswin32/rdoc --exclude ext --main README --quiet ext README docs/README.html
(continuing with the rest of the installation)
这表明库已经安装成功,但是rdoc安装失败了,不影响使用。
继续测试
script/generate scaffold article title:string article:text
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/articles
exists app/views/layouts/
exists test/functional/
exists test/unit/
exists public/stylesheets/
create app/views/articles/index.html.erb
create app/views/articles/show.html.erb
create app/views/articles/new.html.erb
create app/views/articles/edit.html.erb
create app/views/layouts/articles.html.erb
create public/stylesheets/scaffold.css
create app/controllers/articles_controller.rb
create test/functional/articles_controller_test.rb
create app/helpers/articles_helper.rb
route map.resources :articles
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/article.rb
create test/unit/article_test.rb
create test/fixtures/articles.yml
create db/migrate
create db/migrate/20090225144729_create_articles.rb
产生相应的骨架后,
rake db:migrate
出错
>rake db:migrate
(in E:/workspace/studyRails)
rake aborted!
Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES
(See full trace by running task with --trace)
>
通过
gem list --local
>gem list --local
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activerecord-jdbc-adapter (0.9)
activerecord-jdbcmysql-adapter (0.9)
activeresource (2.2.2)
activesupport (2.2.2)
addressable (2.0.2)
cgi_multipart_eof_fix (2.5.0)
data_objects (0.9.11)
extlib (0.9.10)
fxri (0.3.6)
fxruby (1.6.16)
gem_plugin (0.2.3)
hpricot (0.6.164)
jdbc-mysql (5.0.4)
linecache (0.43)
log4r (1.0.5)
mongrel (1.1.5)
mysql (2.7.3)
ptools (1.1.6)
rails (2.2.2)
rake (0.8.3, 0.8.1)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.2)
ruby-opengl (0.60.0)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)
>
发现mysql库的版本为2.7.3,猜测是不是mysql版本跟库不匹配造成?
查询mysql的帮助文档
Commands out of sync in client错误
如果你在你的客户代码中得到Commands out of sync; You can't run this command now
,你正在以错误的次序调用客户函数!
这可能发生,例如,如果你正在使用mysql_use_result()
并且在你已经调用了mysql_free_result()
之前试图执行新查询。如果你在mysql_use_result()
或mysql_store_result()
之间试图执行返回数据的2个查询,它也可能发生。
通过trace跟踪
rake db:migrate --trace
>rake db:migrate --trace
(in E:/workspace/studyRails)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
rake aborted!
Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:188:in `log'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:309:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:414:in `tables'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/schema_dumper.rb:61:in `tables'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/schema_dumper.rb:23:in `dump'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/schema_dumper.rb:17:in `dump'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:246
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:245:in `open'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:245
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:112
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
>
发现出错的地方位于mysql_adapter.rb:414,代码
def tables(name = nil) #:nodoc: tables = [] execute("SHOW TABLES", name).each { |field| tables << field[0] } #414行 tables end
为什么出这个错呢?猜测是mysql的库不匹配,先前把%MYSQL_HOME%/bin下的libmySQL.dll复制到%RUBY_HOME%/bin目录下,根据推测,用InstantRails-2.0-win.zip下的libmySQL.dll替换,再次跑db:migrate,果真一切ok。
真可谓一波三折矣!
相关推荐
在本教程中,我们将深入探讨如何在Windows操作系统上搭建Rails 2.2.2的开发环境。Rails是一个基于Ruby编程语言的开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,使得Web开发变得更加简洁高效。本文将...
10. **Gemfile与Bundler**:Rails项目通过Gemfile声明依赖的外部gem,Bundler管理这些gem的安装和版本控制。 学习Rails 2.2.2的参考手册,你需要了解上述这些核心概念,并通过实践加深理解。尽管Rails已经发展到更...
标题 "基于Rails2.2.2的ajax" 涉及的是使用Rails 2.2.2框架中的AJAX(Asynchronous JavaScript and XML)技术。Rails是一个基于Ruby编程语言的开源Web开发框架,它允许开发者以简洁、高效的方式构建动态网站。在...
在Rails 2.2.2中,ActiveRecord支持多种数据库,如MySQL、PostgreSQL等,并引入了如动态查找、关联和验证等特性。 2. **ActionController**:处理HTTP请求并生成HTTP响应的核心组件。它负责路由请求到相应的控制器...
【标题】"基于Rails2.2.2的自建的CRUD项目视频" 在这个项目中,我们将探讨如何使用Ruby on Rails 2.2.2版本构建一个基础的CRUD(创建、读取、更新和删除)应用。Ruby on Rails 是一个流行的开源Web应用程序框架,它...
标题 "rails3.1安装与mysql配置 windows" 涉及到的是在Windows操作系统上安装Ruby on Rails 3.1框架并配置MySQL数据库的过程。这是一个关键的开发环境设置步骤,对于使用Rails进行Web开发的程序员来说至关重要。Ruby...
Rails 2.2.2 API 是一个针对 Ruby on Rails 框架的版本 2.2.2 的接口文档,它是开发人员的重要参考资料,用于理解并有效地使用该框架的各项功能。Ruby on Rails(RoR)是由 David Heinemeier Hansson 创建的一个开源...
rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails ...
2.进入rails目录使用gem命令安装(这一步必须要上一步已经安装成功)。如果安装不成功使用ruby,如下: ruby -S gem install rails-2.2.2.gem 3.复制libmySQL.dll到ruby的安装目录的bin文件夹下,然后使用gem安装...
Ruby on Rails 安装及 MySQL 数据库配置指南 本文详细介绍了 Ruby on Rails 的安装步骤,以及 MySQL 数据库的配置方法,并提供了一些官方阅读资源。 一、Ruby on Rails 安装 Ruby on Rails 的安装可以分为以下几...
总结来说,解决Rails与MySQL连接问题涉及检查配置文件、安装和更新依赖、确保系统库完整、确认服务状态和网络连接以及处理版本兼容性。通过排查这些方面,大部分问题都能迎刃而解。在遇到问题时,查看错误日志、查阅...
解决 Rails bundle 安装不上 mysql gem包的问题 环境 ubuntu 12.04 ruby-2.1.1 首先 新建一个的一个项目,在该项目上执行 bundle install 提示 代码如下: … Make sure that gem install mysql2 -v ‘0.3.16’; ...
通过以上步骤,你已经在Ubuntu 11.04上成功搭建了一个基于Ruby on Rails和MySQL数据库的开发环境,并创建了一个基础的Web应用。这不仅为后续的开发工作提供了便利,也加深了对Ruby on Rails框架及MySQL数据库配置的...
你可以从RubyForge网站上下载最新的One-Click Installer版本,安装过程中确保勾选了GEM选项。安装完毕后,Ruby环境就已经准备好了。 接下来是安装Rails框架。推荐在线安装,因为Rails会自动寻找并安装最新版本及其...
《应用Rails进行敏捷Web开发》中文第三版是针对Ruby on Rails框架的一本详尽指南,主要聚焦于Rails 2.2.2版本。Ruby on Rails(简称Rails)是一款基于Ruby编程语言的开源Web应用程序框架,它遵循“Don't Repeat ...
Windows平台上安装Redmine的详细指南 Redmine是一个使用Ruby on Rails(简称RoR)框架建立的灵活的项目管理工具。它提供了基本的需求管理、缺陷管理功能,还提供了新闻发布、Wiki、论坛等其他功能。下面详细介绍了...
在Rails中集成MySQL,你需要安装特定的数据库适配器,即`mysql2` gem。这个gem允许Rails与MySQL数据库进行通信,处理SQL查询并管理数据库连接。在`Gemfile`中添加以下行来安装`mysql2` gem: ```ruby gem 'mysql2' ...
通过以上步骤,你应该能够成功地在你的机器上安装和运行Rails。不过,Ruby on Rails是一个庞大的生态系统,有很多深入的主题值得探索,如MVC架构、ActiveRecord、路由、控制器、视图、测试等。随着对Rails的理解加深...