Jump to content

Recommended Posts

Okay so here is the situation. I keep getting generic runaround answers from godaddy and it is extremely frustrating.

 

So I am a web developer, and I designed a site for a customer in PHP5 and MySQL4.1 and everything was working perfect on my godaddy account. I transferred the files and database over to my clients godaddy account and the setup is exactly the same. However the database is jacked up! I have tried creating several databases all with the same problem.

 

The query I am running against the database is

SELECT DISTINCT city FROM `zip_code` WHERE state_name='$state' ORDER BY city ASC

works fine on my account.

 

However the page displays: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

 

The connection works no problem, or DIE is not executing on the mysql connection. To further add to the problem when I try to run that query on the database itself through phpmyadmin I get an error saying "the table does not exist"... Well thats funny, it does exist, and in fact it has 89k records in it!

 

Why would this work no problems on my account, but on my clients account it doesnt? Godaddy support is a joke BTW, its all canned responses that dont answer your questions at all.

Link to comment
https://forums.phpfreaks.com/topic/132080-godaddy-mysql-problems/
Share on other sites

The error you are recieving can usually be avoided by using 127.0.0.1 as the host instead of localhost if it is indeed localhost you are using. The issue however could be any number of things. /var/lib/mysql/mysql.sock not existing on the server or having the wrong permissions to name a few.

yeah unforunately its godaddy shared hosting and its not running on localhost. I am using the connection string they gave me in the toolbar, but who knows whats going on. Even godaddy doesnt know whats going on which is really lame.

 

Im wondering if I can point the domain to my shared hosting account because they dont allow remote database connections unfortunately.

so here is what i have done now. In an effort to tackle this another way.

 

I have a dedicated server with server4you. I setup the database there.

edited the my.cnf file to listen in on the public IP of the server.

added remote access for the user via command prompt via:

GRANT ALL ON dialone.* TO dialone@'%' IDENTIFIED BY '******';

restarted mysql.

 

Now i get a connection error: Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/content/d/i/a/dial1auto/html/dbconnect.php on line 9

Unable to connect to database! Please try again later.

 

I've followed the remote access tutorial to a T, so I'm a bit lost as to what i need to do to get this to work.

 

 

Now if i telnet to my server ip on port 3306 it connects no problem though. so I'm not sure whats

up.

 

This my dbconnect.php file:

 

<?PHP
//Connect to Database and write the URL into the profile
//Connect To Database
$DBhostname='xx.xx.xx.xx';
$DBusername='dialone';
$DBpassword='xxxxxxxxxxx';
$DBdbname='dialone';

mysql_connect($DBhostname, $DBusername, $DBpassword) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db('dialone');
?>

  • 1 month later...

I'm not sure if you've found a solution or not but I was having the same issues connecting. I tried 127.0.0.1, and local host with the same errors. I found that if you look at the Databases tab in your godaddy database page you will see the server IP address at the top. Use that in place of 127.0.0.1 or local host. It worked for me :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.