views:

54

answers:

3

Hi, I am getting this error in my terminal when i execute the command above,

Deans-MacBook:depot dean$ rake db:create RAILS_ENV='development'
(in /Users/dean/src/RailsBook/depot) Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"depot_development", "host"=>"localhost", "password"=>nil}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

In database config file i have the following:

development:
    adapter: mysql 
    database: depot_development 
    username: root
    password: 
    host: localhost        

I have the mysql gem installed and now i am unsure on what to do next. I am running snow leopard on a Macbook. Does anyone know why this error is happening? Thanks in Advance
Dean
EDIT
Executed the command in the comment and got the following:

Deans-MacBook:depot dean$ rake -t db:create RAILS_ENV='development'
(in /Users/dean/src/RailsBook/depot)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"depot_development", "host"=>"localhost", "password"=>nil}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

EDIT 2 I have uninstalled the mysql gem and reinstalled it and i noticed that an error happened here it is:

Deans-MacBook:~ dean$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate

I hope this helps.

A: 

Wild guess -- no password configured on your Mysql instance? Did you try removing the password line from config/database.yml?

zetetic
nope sorry I have also now changed the privileges on the DB server and i'm still getting the error.
Dean
A: 

Solution upgrade to 64bit version of mysql.

Dean
A: 

Re-install mysql-server and mysql-client using this command:

sudo apt-get install mysql-server mysql-client

and then here are some libraries you need to install to make MySQL available to ruby:

sudo apt-get install libmysql-ruby

This all solved my problem. Try it !!! :)

Nimesh Nikum
How would this help me as im running OS X? I found a solution 5 months ago as well.
Dean