Can't connect to local MySQL server through socket - Fedora

0

I am a new Fedora user and I am installing ROR on my machine.

But when I try to enter the following command rake db:create 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]$

smehsan

Posted 2016-05-15T12:22:08.987

Reputation: 13

Have you got latest Fedora with all the updates? In Fedora, mysqld.sock is in /var/lib/mysql and not in /var/run/mysqld. It looks like you have mysql2 gem built for different mysql headers. So this means there's something wrong you did before with installing rails, gems and mysql servers and building them against wrong server configurations. – Andrew Smith – 2016-05-15T13:54:57.787

@AndrewSmith thank you. Can you please tell me how can i fix this problem? – smehsan – 2016-05-15T18:16:43.510

Nuke the mysql2 gem and run bundle install again to rebuild it. If that doesn't help, look carefully at your MySQL server configuration. – Michael Hampton – 2016-05-16T05:43:27.253

No answers