Forum: Ruby on Rails Error: Can't connect to local MySQL server through socket

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1d6f5cc16502bf3a13712256a35b19c1?d=identicon&s=25 Sm Ehsan (ehsan)
on 2016-05-15 14:15
Hi
I am a new fedora user and i am installing ROR on my machine. but when i
try to enter the following command, it shows the following errors.
can any one please tell me how can i solve this problem.


[smehsan@localhost proone]$ rake db:create
#<Mysql2::Error: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (13 "Permission denied")>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8",
"pool"=>5, "username"=>"root", "password"=>nil,
"socket"=>"/var/run/mysqld/mysqld.sock",
"database"=>"proone_development"}, {:charset=>"utf8",
:collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching
collation)
#<Mysql2::Error: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (13 "Permission denied")>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8",
"pool"=>5, "username"=>"root", "password"=>nil,
"socket"=>"/var/run/mysqld/mysqld.sock", "database"=>"proone_test"},
{:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching
collation)
[smehsan@localhost proone]$
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-05-15 14:27
(Received via mailing list)
On 15 May 2016 at 13:15, Sm Ehsan <lists@ruby-forum.com> wrote:
> "pool"=>5, "username"=>"root", "password"=>nil,
That says you are trying to connect as user root with no password.  Is
that what you intended?  If not have you got the correct user and pwd
in config/database.yml?

Colin
1d6f5cc16502bf3a13712256a35b19c1?d=identicon&s=25 Sm Ehsan (ehsan)
on 2016-05-15 14:30
Thank You @colin

But how can i change that and where can i find config/database.yml file?
1d6f5cc16502bf3a13712256a35b19c1?d=identicon&s=25 Sm Ehsan (ehsan)
on 2016-05-15 14:35
Colin Law wrote in post #1183468:
> On 15 May 2016 at 13:15, Sm Ehsan <lists@ruby-forum.com> wrote:
>> "pool"=>5, "username"=>"root", "password"=>nil,
> That says you are trying to connect as user root with no password.  Is
> that what you intended?  If not have you got the correct user and pwd
> in config/database.yml?
>
> Colin


"Here is my database.yml file"

https://gist.github.com/ehsanatwork/60d8c258606ab6...
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-05-15 14:35
(Received via mailing list)
On 15 May 2016 at 13:30, Sm Ehsan <lists@ruby-forum.com> wrote:
> Thank You @colin
>
> But how can i change that and where can i find config/database.yml file?

Please remember to quote the previous message when replying, otherwise
no-one knows what you are referring to.  This is a mailing list not a
forum, though you may be accessing it via a forum-like interface.
Thanks.

It is in the config folder in your rails application.
Since you did not know that I suggest that you work right through a
good tutorial such as railstutorial.org (which is free to use online).
That will show you the basics of rails.

Colin
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-05-15 14:39
(Received via mailing list)
On 15 May 2016 at 13:35, Sm Ehsan <lists@ruby-forum.com> wrote:
> "Here is my database.yml file"
>
> https://gist.github.com/ehsanatwork/60d8c258606ab6...

As I thought, you have specified root and no password as the default,
and used that for development.  I suggest working through the
tutorial, it will save you a lot of time.

Colin
1d6f5cc16502bf3a13712256a35b19c1?d=identicon&s=25 Sm Ehsan (ehsan)
on 2016-05-15 14:41
Colin Law wrote in post #1183472:
> On 15 May 2016 at 13:35, Sm Ehsan <lists@ruby-forum.com> wrote:
>> "Here is my database.yml file"
>>
>> https://gist.github.com/ehsanatwork/60d8c258606ab6...
>
> As I thought, you have specified root and no password as the default,
> and used that for development.  I suggest working through the
> tutorial, it will save you a lot of time.
>
> Colin

Thank you,
Did you check the gist.
I have installed ruby, rails, mysql database.
but i am toomuch confused why this errors happen?
I hope you will help me.
Thank You
1d6f5cc16502bf3a13712256a35b19c1?d=identicon&s=25 Sm Ehsan (ehsan)
on 2016-05-15 14:46
which tutorial?
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-05-15 14:48
(Received via mailing list)
On 15 May 2016 at 13:41, Sm Ehsan <lists@ruby-forum.com> wrote:
>> Colin
>
> Thank you,
> Did you check the gist.

Yes, in there you have specified user root with no password, which I
presume is not what you intended.
To fix it you must use a valid user/pwd for your mysql server.

Colin
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-05-15 14:49
(Received via mailing list)
On 15 May 2016 at 13:46, Sm Ehsan <lists@ruby-forum.com> wrote:
> which tutorial?

The one in my second (I think) post.

Colin
This topic is locked and can not be replied to.