NameSilo

Help! MySql and GoDaddy!

Spaceship Spaceship
Watch

FathomJH

Established Member
Impact
22
<?php
DEFINE ('DB_USER', 'username');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'sitename');

//make the connection
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySql: ' . mysql_error() );

//select the database
@mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );

?>

i use this to make a connection and when i go to test to see if it works, i get this message:

Could not connect to MySql: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Any ideas why? Thank you for any help :D!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Are you sure its localhost?
 
0
•••
hmm, good point, ill give it a try the other way :D
 
0
•••
Just a word of warning godaddy and phpmyadmin = annoyance I have had to move so many clients from them as the features they have limited with their phpmyadmin is amazing you can hardly do anything with it

I am sure godaddy is on local host you probably have the user/password wrong
 
0
•••
In godaddy it will surely be not globalhost. Go to your control panel and see the name of the database host.
 
0
•••
Either you are not using the correct host name or they are having an issue with the mysql server.
 
0
•••
W00t W00t. Got it to work, lousy godaddy :bah: . I ended up mixing up the code. Got it to work B-)

used this instead

mysql_connect("HOSTNAME", "DATABASE", "PASSWORD") OR die( mysql_error() );
mysql_select_db("DATABASE") OR die( mysql_error() );
 
0
•••
another thing that irks me about godaddy is that they use a proxy.

try to use the paypal IPN script and it wont work. i had to recode a cURL version of it just so i can get it to work.


and also, the mysql db hostname is 99% not localhost, mine was like mysql21.624 or something (all fake stuff, but that was the general pattern, obv NOT localhost)
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back