Well ok, i should rather ask, how to connect to mysql server without using sockets. This is how i connect at this time:
require_once('DB.php');
function connect_to_manish_db(){
global $__db;
$mode = DB_FETCHMODE_ASSOC;
$user = 'root';
$pass = '';
$host = 'localhost';
$db_name = 'whatevernameitis';
$dsn = "mysql://$user:$pass@$host/$db_name";
$__db = DB::connect($dsn, true);
return $__db;
}
?>
I also tried this way :
function dbConnectionManish(){
global $___dbConn;
if(!$___dbConn){
$___dbConn = mysql_connect('localhost','root','');
if(!$___dbConn){return false;}
$selectDB = mysql_select_db('whateverdbnameis');
if(!$selectDB){return false;}
}
return $___dbConn;
}
I am hosting with www.streamline.net, using linux server and PHP.
I get this error very often:
Warning: mysql_connect(): Can't connect to MySQL server on 'mysql8.streamline.net' (4) in /home/fhlinux191/m/manish.sentosajaipur.com/user/htdocs/include/functions.common.php on line 6...
streamline line says use tcp
2006-07-20
08:11:19
·
3 answers
·
asked by
Manish
5
in
Computers & Internet
➔ Programming & Design
Full description of the error:
Warning: mysql_connect(): Can't connect to MySQL server on 'mysql8.streamline.net' (4) in /home/fhlinux191/m/manish.sentosajaipur.com/user/htdocs/include/functions.common.php on line 6
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/fhlinux191/m/manish.sentosajaipur.com/user/htdocs/include/kbserver.php on line 58
Warning: mysql_query(): A link to the server could not be established in /home/fhlinux191/m/manish.sentosajaipur.com/user/htdocs/include/kbserver.php on line 58
Query failed.Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
2006-07-20
08:11:36 ·
update #1