Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?

From: Date: Sun, 11 May 2008 05:02:37 +0000
Subject: Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-274129@lists.php.net to get a copy of this message
On Sun, May 11, 2008 at 12:42 AM, Rahul <rahul986@gmail.com> wrote: > Thanks a lot for your reply. > > I have tried using > > $host = "localhost"; > $db = "dbname"; > $table_main = "tablename"; > $dbusername = "root"; > $dbpass = "passhere"; > > mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); > > and > > $host = "mycomputer.webaddress.com"; > $db = "dbname"; > $table_main = "tablename"; > $dbusername = "root"; > $dbpass = "passhere"; > > mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); > > And this mycomputer.webaddress.com works when I use with mysql like this: > > mysql -h mycomputer.webaddress.com -u root -p so, from above (previous post), it looks like the errors youve shown are actually coming from mysql_query(). what is the result of this (using credentials from this post and [mycomputer.webaddress.com]) <?php if(!mysql_connect($host, $dusername, $dbpass)) { die(mysql_error()); } else { die('successful connection established'); } -nathan

« previous php.general (#274129) next »