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 |

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’

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

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

Frederick Cheung wrote in post #987179:

Frederick Cheung wrote in post #987179:

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.

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

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.

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

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://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

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