首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rubyonrails mysql2

rubyonrails mysql2
EN

Stack Overflow用户
提问于 2011-11-11 05:03:40
回答 2查看 705关注 0票数 2

嗨,我只是想知道我的数据库连接配置是否正确。

代码语言:javascript
复制
development:
  adapter: mysql2
  encoding: utf8
  database: db/glob_development
  pool: 5
  username: root
  password: mysql
  host: localhost
  socket: /tmp/mysql.sock
  timeout: 5000

因为当我试图运行rake:db:create时

它是这样的

代码语言:javascript
复制
WARNING: This version of mysql2 (0.2.17) isn't compatible with Rails 3.1 as the ActiveRecord adapter was pulled into Rails itself.
WARNING: Please use the 0.3.x (or greater) releases if you plan on using it in Rails >= 3.1.x
DEPRECATION WARNING: Arel::Visitors::VISITORS is deprecated and will be removed. Database adapters should define a visitor_for method which returns the appropriate visitor for the database. For example, MysqlAdapter.visitor_for(pool) returns Arel::Visitors::MySQL.new(pool). (called from mon_synchronize at /home/led/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201)
db/test.sqlite3 already exists
db/production.sqlite3 already exists

im运行在fedora15 1.9.2p290 ruby版本rails 3.1.1中

编辑

只需下载mysql2并更改我的and文件

代码语言:javascript
复制
gem 'mysql2', '~>0.3.10'

嗯,只是想知道终点站一直在说

代码语言:javascript
复制
db/glob_development already exists
db/test.sqlite3 already exists
db/production.sqlite3 already exists

但我的db文件夹剂量有glob_development文件,是一个错误还是它是自然的?对不起,伙计们

EN

回答 2

Stack Overflow用户

发布于 2011-11-11 05:37:07

当您运行rake db:create时,它会说它工作正常,而且这些数据库已经存在。查看MySQL工作台上的数据库(或者通过终端中的命令行接口检查它们)。

运行一个rake db:migrate来更新数据库。

如果您没有在"db“文件夹中看到它,请尝试连接到mysql服务器并进行检查。你有这方面的细节吗?它通过/tmp/mysql.sock连接到mysql服务器。

检查用户名和密码是否从mysql连接到数据库(使用上述方法之一)。

票数 1
EN

Stack Overflow用户

发布于 2012-05-13 14:03:24

代码语言:javascript
复制
rails new project_name 

上面的行创建了一个新项目,并创建了SQLite数据库。但如果你跑了

代码语言:javascript
复制
rails new project_name -d mysql

然后数据库没有创建,您必须运行

代码语言:javascript
复制
rake db:create

您的问题可能与适配器有关,我在mac中遇到了这个问题。我不得不将适配器选项更改为mysql。还包括Gemfile中的mysql。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8089909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档