I'm starting a new rails 3 app and when I run rake db:create it asks for my root mysql password then errors out saying:
Mysql2::Error: Access denied for user 'arcsite_mysql'@'localhost' to database 'arcsite_mysql_test': CREATE DATABASE
arcsite_mysql_testDEFAULT CHARACTER SETutf8COLLATEutf8_unicode_ci
If I log into mysql on the command line and run show databases; I see this:
arcsite_mysql_development
And if I run SHOW GRANTS FOR arcsite_mysql@localhost I see this:
GRANT ALL PRIVILEGES ON `arcsite_mysql_development`.* TO 'arcsite_mysql'@'localhost' WITH GRANT OPTION
My database.yml:
# 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
reconnect: false
database: arcsite_mysql_development
pool: 5
username: arcsite_mysql
password: password
host: localhost
# Warning: 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
reconnect: false
database: arcsite_mysql_test
pool: 5
username: arcsite_mysql
password: password
host: localhost
So, for some reason, only the development database is being created.
Versions:
Rails 3.2.13
MySQL: Server version: 5.6.10 Source distribution
mysql2: mysql2-0.3.11
EDIT
If I manually grant all the privileges to the arcsite_mysql user, I can create the tables. But is it expected that Rails would create the user and table for development but not for the test environment? The arcsite_mysql user is created by rails when I first ran the rake db:create command.
EDIT 2
Point 4 here: https://rails.lighthouseapp.com/projects/8994/tickets/1459-patch-better-dbcreate-for-mysql-do-not-assume-root-user
mentions something about "well known" process that involves mysql user creation.
arcsite_mysqlexist in mysql? I do not think it should be asking you for a root password if this user exists and has proper permissions. Maybe something like this will do the trick if not:GRANT ALL ON *.* TO 'arcsite_mysql'@'localhost' IDENTIFIED BY 'password';rake db:createcommand.FATAL: role "user" does not existmy guess would be that maybe it was made/existed before but with incorrect permissions? The command i posted only updates an existing user and does not create one