专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Ruby/Rails

ruby on rails入门有关问题

发布时间:2011-06-29 18:10:46 文章来源:www.iduyao.cn 采编人员:星星草
ruby on rails入门问题
小弟现在想学RoR,因为它号称开发速度是Java的5到10倍。不过现在比较郁闷,就是一个demo都没有弄出来。
我的OS是:win7
我的mysql版本:5.0.27
我的ruby的版本是:1.9.2
我的rails的版本是:Rails 3.1.1.rc3

每次都是数据库连接的问题:
D:\Ruby1.9.2\project>rake db:create
rake aborted!
uninitialized constant Mysql

我的yml配置文件的信息是这样的:
development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: ruby_project_development
  username: root
  password: root
  pool: 5
  timeout: 5000




后来我用IDE了,里面的命令是:
D:\Ruby1.9.2\Ruby192\bin\rake db:migrate
rake aborted!
Can't connect to MySQL server on 'localhost' (10061)

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

请大家帮个忙,给我点建议和帮助,帮我带上路,谢谢!
------解决方案--------------------
>gem list

看看有 这个gem没有。

mysql2 (0.2.6 x86-mingw32)

没有就gem install mysql2
------解决方案--------------------
你MySQL可能没开
------解决方案--------------------
maybe you can add 'host: loaclhost' in your database.yml. but this isn't mandatory. default value is localhost.

rake db:create
this command will create development and test database in your mysql server. the error message has told you. you cannot connect mysql server.

so, first you need to check mysql server status.
make sure mysql is running and you can access your mysql server from you local machine.
second, you need to check mysql rubygem, make sure it has been installed.
you can use 'gem list' to check it.
third, make sure the 'ruby_project_development' exists in your mysql database. 'rake db:create' this command will create it.
hope this is helpful for you.


------解决方案--------------------
引用:
maybe you can add 'host: loaclhost' in your database.yml. but this isn't mandatory. default value is localhost.

rake db:create
this command will create development and test database in your mysql ……


+1
------解决方案--------------------
现在的适配器应该是mysql2了吧。
------解决方案--------------------
楼上说的都有理啊,首先要有mysql,并且打开;还有要有适配器,即安装gem mysql2
------解决方案--------------------
原以为学ruby的人很少,原来有这么多志同道合的,我刚学,受教了
------解决方案--------------------
引用:
现在的适配器应该是mysql2了吧。

我现在配置的也是mysql2
------解决方案--------------------
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: