No mysql hostname was specified error


#1

While connecting to a database i am getting this error:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can’t connect to local MySQL server through socket ‘/No-MySQL-hostname-was-specified’ (2)

But same configuration is working correctly on other host and also on xampp on my local machine.

after comparing both the host I have found a difference.

For DH:
Server: mysql.mydomain.biz via TCP/IP
Server version: 5.1.56-log
Protocol version: 10
User: root_bhav@professor.dreamhost.com
MySQL charset: UTF-8 Unicode (utf8)

For other host:
Server: Localhost via UNIX socket
Software version: 5.1.68-cll - MySQL Community Server (GPL)
Protocol version: 10
User: refoet@localhost
Server charset: UTF-8 Unicode (utf8)

difference between both host is via UNIX socket and via TCP/IP.
Is that the issue??? please guide me.


#2

Check informations in your main config files.