Error creating Rails DB using rake db:create
Thanks for all the help guys. Looks like the problem had to do with my install of the mysql gem under OSX.
@tim after I proceeded to the next step and got up and going I got an error on the console, so I did a bit of searching and found this helpful thread.
After I uninstalled my ruby gems gem uninstall mysql
I installed the proper mysql gems using this command (from the thread):
export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
After executing this one I was able to successfully run rake db:create
and proceed.
Thanks!!
Unable to create database with rake db:create command
Had this issue and never quite figured out why rails was doing this, but below should fix it.
- in terminal
psql template1
CREATE USER <username from config/database.yml if specified> with password '<password from config/database.yml if specified>';
ALTER USER <username ...> WITH SUPERUSER;
CREATE DATABASE chat_development WITH OWNER = '<username ...>';
CREATE DATABASE chat_test WITH OWNER = '<username ...>';
you don't need step 2/3, or the WITH OWNER = '<username>';
unless you specify a user/password in config/database.yml
.
Some common mistakes, pay close attention to where I have put single quotes, and don't forget the semi-colons!
Error in rake db:create in new rails project
I simply reinstalled ruby+rails and things were alright.
I deleted the ~/.rbenv folder and ran sudo apt-get purge ruby
Then installed ruby and rails using Official Page.
Importantly, once I created a new project I was prompted to install another gem to resolve some dependency gem install rdoc-data
ruby on rails error rake db:create
This will help you.
gem uninstall rake
gem install rake -v 0.8.7
If Still the problem exists, uninstall rake and install using
gem uninstall rake
gem install rake
for more info
Undefined method 'task' using Rake 0.9.0
Issue with rake db:create
Unless you're running Rails 4.2.5 or higher, you'll want to put the following in your Gemfile
:
gem 'mysql2', '~> 0.3.10'
Source: mysql gem compatibility listing
Error when trying to create database with Rails, rake db:create
Are you allowed to use the root user without password? Is the mysqlserver listening on 127.0.0.1 or localhost?
not able to create database use rake db:create mysql
You should specify the host of database is located. In your database.yml
you should add host: your_host
:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: new-development
pool: 5
host: localhost # <your host>
username: root #< your_username >
password: password #< your_secret_password >
Related Topics
Advice on How to Validate Names and Surnames Using Regex
Why Does the Rand() Return Always the Same Number
Fresh Install of Rails and Getting Openssl Errors: "Already Initialized Constant Openssl"
Rails - X-Sendfile + Temporary Files
Ruby's Argv Can Be Empty on Windows Depending on a Way to Run Script
Floating Point Precision in Ruby on Rails Model Validations
Simple Remote Odbc Database Connection with Ruby
Controller Method #Show Getting Called
Ruby Ternary Operator Structure
Cancan Abilities in Separate File
Ruby on Rails How to Deal with Nan
Ruby on Rails: Creating a Model Entry with a Belongs_To Association
How to Change Environment Variables When Running Rspec for Ruby