Note that there are some explanatory texts on larger screens.

plurals
  1. POrake db:create only creating development database
    primarykey
    data
    text
    <p>I'm starting a new rails 3 app and when I run <code>rake db:create</code> it asks for my root mysql password then errors out saying: </p> <blockquote> <p>Mysql2::Error: Access denied for user 'arcsite_mysql'@'localhost' to database 'arcsite_mysql_test': CREATE DATABASE <code>arcsite_mysql_test</code> DEFAULT CHARACTER SET <code>utf8</code> COLLATE <code>utf8_unicode_ci</code></p> </blockquote> <p>If I log into mysql on the command line and run <code>show databases;</code> I see this:</p> <pre><code>arcsite_mysql_development </code></pre> <p>And if I run <code>SHOW GRANTS FOR arcsite_mysql@localhost</code> I see this:</p> <pre><code>GRANT ALL PRIVILEGES ON `arcsite_mysql_development`.* TO 'arcsite_mysql'@'localhost' WITH GRANT OPTION </code></pre> <p>My database.yml:</p> <pre><code># 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 </code></pre> <p>So, for some reason, only the development database is being created.</p> <p>Versions:</p> <p>Rails 3.2.13</p> <p>MySQL: Server version: 5.6.10 Source distribution</p> <p>mysql2: mysql2-0.3.11</p> <p><strong>EDIT</strong></p> <p>If I manually grant all the privileges to the <code>arcsite_mysql</code> 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 <code>arcsite_mysql</code> user is created by rails when I first ran the <code>rake db:create</code> command.</p> <p><strong>EDIT 2</strong></p> <p>Point 4 here: <a href="https://rails.lighthouseapp.com/projects/8994/tickets/1459-patch-better-dbcreate-for-mysql-do-not-assume-root-user" rel="nofollow noreferrer">https://rails.lighthouseapp.com/projects/8994/tickets/1459-patch-better-dbcreate-for-mysql-do-not-assume-root-user</a></p> <p>mentions something about "well known" process that involves mysql user creation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload