Mysql socket rails

I’m deploying my rails app through capistrano. But when i try to open the page i get (Rails application error)
err in logfiles : Cannot connect through mysql socket

I can connect to my db through mysql -u uname -ppassword -h

I changed my database.yml file to
adapter: mysql
database: dbname
username: uname
password: pwd
port: 3306

anyone any suggestions?