Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
[email protected] ("Nathan Nobbe")
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On Sun, May 11, 2008 at 12:42 AM, Rahul <[email protected]> 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