Can not create DB
d0glike opened this issue · 3 comments
Hello,
I'm stuck creating the DB: when I run rake db:create
, I receive the following output:
/var/lib/gems/2.3.0/gems/activesupport-4.0.3/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"tracker_development", "pool"=>5, "username"=>"root", "password"=>"xxxxxxx", "socket"=>"/var/run/mysqld/mysqld.sock"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"} (If you set the charset manually, make sure you have a matching collation) Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"tracker_test", "pool"=>5, "username"=>"root", "password"=>"xxxxxxx", "socket"=>"/var/run/mysqld/mysqld.sock"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"} (If you set the charset manually, make sure you have a matching collation)
MySQL. Versions 4.1 and 5.0 are recommended.
Install the MYSQL driver
gem install mysql2
Ensure the MySQL gem is defined in your Gemfile
gem 'mysql2'
And be sure to use new-style password hashing:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
database: tracker_development
pool: 5
username: root
password: xxxxxx
socket: /var/run/mysqld/mysqld.sockWarning: The database defined as "test" will be erased and
re-generated from your development database when you run "rake".
Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
database: tracker_test
pool: 5
username: root
password: xxxxxxx
socket: /var/run/mysqld/mysqld.sockproduction:
adapter: mysql2
encoding: utf8
database: tracker_production
pool: 5
username: root
password: xxxxx
socket: /var/run/mysqld/mysqld.sock
Do you have any advice?
Thank you,
B regards
Francesco Lateano
Creating the abstract_mysql2_adapter.rb under config/intializers with the following lines (credit stackoverflow) fixed the issue.
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end
Is a new patch coming or should I send a PR ?
Oh BTW, I still get the above error but the database seems to be created in mysql.