Error: Can't connect to local MySQL server through socket

31 views
Skip to first unread message

Sm Ehsan

unread,
May 15, 2016, 8:16:00 AM5/15/16
to rubyonra...@googlegroups.com
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]$

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
May 15, 2016, 8:26:05 AM5/15/16
to Ruby on Rails: Talk
On 15 May 2016 at 13:15, Sm Ehsan <li...@ruby-forum.com> wrote:
> 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,

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

Sm Ehsan

unread,
May 15, 2016, 8:31:01 AM5/15/16
to rubyonra...@googlegroups.com
Thank You @colin

But how can i change that and where can i find config/database.yml file?

Colin Law

unread,
May 15, 2016, 8:35:20 AM5/15/16
to Ruby on Rails: Talk
On 15 May 2016 at 13:30, Sm Ehsan <li...@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

Sm Ehsan

unread,
May 15, 2016, 8:35:34 AM5/15/16
to rubyonra...@googlegroups.com
Colin Law wrote in post #1183468:
"Here is my database.yml file"

https://gist.github.com/ehsanatwork/60d8c258606ab68494165dc099a2c23d

Colin Law

unread,
May 15, 2016, 8:38:31 AM5/15/16
to Ruby on Rails: Talk
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

Sm Ehsan

unread,
May 15, 2016, 8:41:41 AM5/15/16
to rubyonra...@googlegroups.com
Colin Law wrote in post #1183472:
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

Sm Ehsan

unread,
May 15, 2016, 8:46:30 AM5/15/16
to rubyonra...@googlegroups.com
which tutorial?

Colin Law

unread,
May 15, 2016, 8:48:03 AM5/15/16
to Ruby on Rails: Talk
On 15 May 2016 at 13:41, Sm Ehsan <li...@ruby-forum.com> wrote:
> Colin Law wrote in post #1183472:
>> On 15 May 2016 at 13:35, Sm Ehsan <li...@ruby-forum.com> wrote:
>>> "Here is my database.yml file"
>>>
>>> https://gist.github.com/ehsanatwork/60d8c258606ab68494165dc099a2c23d
>>
>> 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.

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

Colin Law

unread,
May 15, 2016, 8:48:39 AM5/15/16
to Ruby on Rails: Talk
On 15 May 2016 at 13:46, Sm Ehsan <li...@ruby-forum.com> wrote:
> which tutorial?

The one in my second (I think) post.

Colin

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f4c887b299041244cfca4aebbfbc557c%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages