Solved

Rails rake db:create causing error

Posted on 2008-10-31
9
3,096 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
 
LVL 14

Expert Comment

by:wesgarrison
ID: 22855633

# in database.yml

  socket: /path/to/your/mysql.sock

Open in new window

0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now