【问题标题】:rake db:multi:migrate DATABASE=configuration error with JRuby, mysql, riakrake db:multi:migrate DATABASE=JRuby、mysql、riak 的配置错误
【发布时间】:2013-08-09 14:38:11
【问题描述】:

JRuby 1.7.1 和 Rails 3.2.11

在终端中,我正在运行“rake db:multi:migrate DATABASE=configuration”,但我不断收到以下错误消息,据我所知,配置数据库没有被创建。

Connecting to database specified by database.yml
(4.0ms)  SET SQL_AUTO_IS_NULL=0
rake aborted!
The driver encountered an unknown error: 
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'configuration'

我应该按照以下具体步骤进行设置:

mysql.server start

mysql -uroot
create user 'funapp_test'@'localhost' IDENTIFIED BY 'funapp_test';
grant all privileges on *.* to 'funapp_test'@'localhost' with grant option;
create user 'funapp'@'localhost' IDENTIFIED BY '#sh4r3!';
grant all privileges on *.* to 'funapp'@'localhost' with grant option;

RAILS_ENV=test rake db:create
RAILS_ENV=development rake db:create

mysql -uroot funapp_test < db/structure.sql
mysql -uroot funapp < db/structure.sql

rake db:multi:migrate DATABASE=funapp
rake db:multi:migrate DATABASE=configuration

数据库.yml

development:
adapter: mysql
database: funapp
username: funapp
password: "#sh4r3!"
host: 127.0.0.1
pool: 5
xa: false

test: &test
adapter: mysql
database: funapp_test
username: funapp_test
password: "funapp_test"
host: 127.0.0.1
pool: 5
xa: false

configuration_development:
adapter: mysql
database: configuration
username: funapp
password: "#sh4r3!"
host: 127.0.0.1
pool: 5
xa: false

configuration_test:
adapter: mysql
database: configuration_test
username: funapp_test
password: "funapp_test"
host: 127.0.0.1
pool: 5
xa: false

有什么想法可以解决这个问题吗?我试过做 rake db:drop 和 rake db:migrate,以及 rake db:create:all (这给了我一个 Riak::Node 配置必须包括 :source 和 :root 键。错误)非常感谢!

【问题讨论】:

    标签: mysql ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 jruby


    【解决方案1】:

    想通了,比我想象的要简单得多

    mysql -uroot
    create database configuration;
    create database configuration_test;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-08
      • 2016-12-28
      相关资源
      最近更新 更多