Solved

Rails rake db:create causing error

Posted on 2008-10-31
9
3,111 Views
Last Modified: 2013-11-13
I am trying to start up a rails project and I run:

rake db:create

And I get:

Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "host"=>"localhost", "password"=>"root", "database"=>"MyProject_development"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)

Any idea why? I did some searching on google and not sure why it is doing that, and my MySQL server is up. I am using MAMP, so I am not using the default mysql.sock, I tried this but not sure if it worked:

http://www.nogeek.org/2008/08/10/no-such-file-or-directory-tmpmysqlsock/

Thoughts?
0
Comment
  • 5
  • 3
9 Comments
 
LVL 14

Expert Comment

by:wesgarrison
ID: 22855588
Can you connect with the username/password of root/root with the plain mysql command line console, just to confirm that your password is correct?
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 22855614
I got it, I just had to add in my sock to specifiy it. Do you know if there is a way to always use that sock to by default?

0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 22855632
Hey, I also have another question here if you have a second:

http://www.experts-exchange.com/Programming/Editors_IDEs/RubyOnRails/Q_23866977.html

thank you!

Ryan
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:wesgarrison
ID: 22855633

# in database.yml
  socket: /path/to/your/mysql.sock

Open in new window

0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 22855640
Yeah.. I got that, but is there away to set a default so everytime you create a new server it uses that? Or do I need to enter it manually?

Thanks,

Ryan
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 22855641
Yeah.. I got that, but is there away to set a default so everytime you create a new server it uses that? Or do I need to enter it manually?

Thanks,

Ryan
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 22855838
"Create a new server"?  Not sure what you mean.

You'll have to set that in every Rails project you create, yes, just like you might have a different password for each database or environment you might have.
0
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 500 total points
ID: 22856485
" charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)"

In your config/database.yml file try to remove the line encoding: ...

I had this problem when trying to migrate to a mysql database, removing this line fixed it for me.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 22858118
Thank you both! i will give that a try!

Ryan
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question