Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations

Robert Ott
PLUS
Robert Ott
Courses Plus Student 4,614 Points

rake db:create WORKS!!! but...

I tried to run rake db:create a couple of times but kept getting this error message:

Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"biller_development"}, {: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", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"biller_test"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"} (If you set the charset manually, make sure you have a matching collation)

I know I have a working install because I successfully completed the Database Foundations track yesterday. SO I went to MYSQL Workbench and started the MYSQL Server.

Then I went back and ran rake db:migrate and it worked without errors.

When I run: mysql (anything) from the /biller directory I get: -bash: mysql: command not found

I'm guessing that it is a path or an environment variable but I have NO idea where to start. If you look up 'n00b' in the dictionary you'll see a picture of me.

Thanks in advance! Robert

Akilah Jones
Akilah Jones
18,397 Points

Try installing the mysql2 gem...

$ gem install mysql2

Robert Ott
Robert Ott
Courses Plus Student 4,614 Points

Akliah -

Thanks. I had previously installed the mysql2 gem. Here are the first few lines of my gemfile:

source 'https://rubygems.org'

Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

gem 'rails', '4.2.0'

Use mysql as the database for Active Record

gem 'mysql2'

Use SCSS for stylesheets

gem 'sass-rails', '~> 5.0'

Use Uglifier as compressor for JavaScript assets

gem 'uglifier', '>= 1.3.0'

Use CoffeeScript for .coffee assets and views

gem 'coffee-rails', '~> 4.1.0'

See https://github.com/sstephenson/execjs#readme for more supported runtimes

gem 'therubyracer', platforms: :ruby

Any other suggestions? Thanks in advance. Robert

Akilah Jones
Akilah Jones
18,397 Points

No I meant via the command-line...

1) $ gem install mysql2

2) add to gemfile: gem "mysql2"

3) $ bundle install

4) Update database.yml

default: &default adapter: mysql2 pool: 5 timeout: 5000

development: <<: *default adapter: mysql2 database: biller_development

test: <<: *default adapter: mysql2 database: biller_test

Lastly, if you have your project hosted on github then that would be helpful

Best Regards