Can't connect to local MySQL server through socket

asked 2016-05-15 07:16:22 -0500

smehsan gravatar image

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<="" h1="">

'/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<="" h1="">

'/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]$

edit retag flag offensive close merge delete

Comments

probably selinux deny access to mysql socket

Biji gravatar imageBiji ( 2016-05-15 12:10:12 -0500 )edit

Did you try adding the

host: localhost

To your database config file, also can you connect to the database using mysql client as the same user you running rails or rake command.

aeperezt gravatar imageaeperezt ( 2016-05-15 21:55:04 -0500 )edit