Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

Hi peers,

i am facing a problem …
trying to test a website locally …some pages work fine but some others
calling MySQl give me the following errors :

Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’

what i have noticed :

1- no socket file in the /var/lib/mysql/mysql.sock under
/var/lib/mysql/.

2- i was able to locate mysqld.sock file in the following folder

Variable_name | Value |
±--------------±----------------------------+
| socket | /var/run/mysqld/mysqld.sock

3- i tried to change the location to the /var/lib/mysql/mysql.sock’
folder
in both my.cnf & debian.cn f files but no result …

still getting the same error when testing …

any help wil much appreciated

thanks

On Mar 13, 1:55pm, korssane korssane [email protected] wrote:

Hi peers,

i am facing a problem …
trying to test a website locally …some pages work fine but some others
calling MySQl give me the following errors :

If by ‘calling mysql’ you mean when your app tries to use mysql then
check that the socket option in database.yml is correct.

Fred

Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’

Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’

database.yml for mysql defaults to this you can change it with

socket: /var/run/mysqld/mysqld.sock

[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


make haste slowly
festina lente \

mobile +1_415_632_6001
[email protected] [email protected]
http://robotarmyma.de

On 13 Mar 2011, at 16:51, korssane korssane [email protected]
wrote:

but the file itself is missing in the specified location.

Change database.yml to reflect wherever the socket is on your system

Fred

Frederick C. wrote in post #987179:

On Mar 13, 1:55pm, korssane korssane [email protected] wrote:

Hi peers,

i am facing a problem …
trying to test a website locally …some pages work fine but some others
calling MySQl give me the following errors :

If by ‘calling mysql’ you mean when your app tries to use mysql then
check that the socket option in database.yml is correct.

Fred

Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’

hi ,
In my database.yml i have the following :
socket: /var/lib/mysql/mysql.sock

but the file itself is missing in the specified location.

any other suggestions ?

thanks

but the file itself is missing in the specified location.

Change database.yml to reflect wherever the socket is on your system

If you do not know how to do that,
try creating another rails app using the command
$ rails new appname -d mysql

by doing this rails will automatically add the needed mysql configs in
the
database.yml file which is inside the newly created rails app (appname)

hope this helps


Regards,
Magesh

blog: http:// http://magz.posterous.com/imagesh.tumblr.com
web: GeexHQ.com http://geexhq.com/
twitter: @iMagesh http://twitter.com/iMagesh

Can you connect to mysql outside of rails?

mysql -S /var/run/mysqld/mysqld.sock -u username -p
mysql -h hostname -u username -p password database_name

-Fredrik

Fredrik wrote in post #987341:

Can you connect to mysql outside of rails?

mysql -S /var/run/mysqld/mysqld.sock -u username -p
mysql -h hostname -u username -p password database_name

-Fredrik

thank you guys,

not sure what happend but it is working now…
mysqld.sock is there

Thnsk again

Magesh Sathasiva pandian wrote in post #987274:

but the file itself is missing in the specified location.

Change database.yml to reflect wherever the socket is on your system

If you do not know how to do that,
try creating another rails app using the command
$ rails new appname -d mysql

by doing this rails will automatically add the needed mysql configs in
the
database.yml file which is inside the newly created rails app (appname)

hope this helps


Regards,
Magesh

blog: http:// http://magz.posterous.com/imagesh.tumblr.com
web: GeexHQ.com http://geexhq.com/
twitter: @iMagesh http://twitter.com/iMagesh

Hi ,
yes i tried that but the challenge is i am importing a website that has
been build using ruby 1.8 old platform and i am trying to test it
locally on my machine by replicating the same environment

now i can test the website regular pages (html-rb) but everything which
need access to mysql is not working

i am getting the following error :
Can’t connect to local MySQL server through socket
‘/var/run/mysqld/mysqld.sock’ (2)

the weired thing is i have the sock file in the right place…but don’t
know what to do …

?

any help on that?

thanks