I'm using Drupal 5.1 on Godaddy using mySQL 5.0.
I've set drupal up on my localhost and it is running smoothly.
I then setup my GoDaddy database exactly like my local DB. I can access GoDaddy's phpmyadmin and can see my database. It's fine and contains the necessary data.
I used Godaddy's hostname in the settings.php file so the $db_url line now looks like this:
$db_url = 'mysql://myusername:mypassword@p50mysql***.secureserver.net/mydbname';
However I get this error when I try to load the site:
Unable to connect to database server
If you still have to install Drupal, proceed to the installation page.
If you have already finished installed Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can't connect to the MySQL database server. This could mean your hosting provider's database server is down.
The MySQL error was: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2).
Currently, the username is kvg07 and the database server is localhost.
* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct hostname?
* Are you sure that the database server is running?
For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.
Would appreciate help on this. Thanks.
P.S. I read another post where the steps mentioned above were posted as a solution but that was using Godaddy's mySQL 4.x...but I followed the same steps and it couldn't read from the DB.
Comments
Try Using Localhost Instead of the Host Name.
Try connecting via localhost instead of the host name.
the $db_url should look like:
$db_url = 'mysql://myusername:mypassword@localhost/mydbname';
Make sure the DB user has privileges to connect the the database via localhost. (You can check that with phpMyAdmin.)
John Berns
Travel Guide
Travel Photographer
Hi John, I think I mentioned
Hi John,
I think I mentioned that I already did that...
The problem with godaddy is that it has a modified phpmyadmin and you can't tinker around with user privileges. The tab/link doesn't exist.
I Think There Is a Communicaions Gap Here.
When you said localhost... you seemed to be talking about the computer on your desktop, right? That's not what localhost refers to in networking...
Have you tried the connection string I suggested on GoDaddy or not?
Localhost does not refer to the computer on your desk; localhost is hostname that resolves to the IP address 127.0.0.1, the loopback address, which, for every computer on a TCP/IP network, refers to the computer itself.
http://localhost/ connects to the webserver on the same computer as the browser; ping localhost pings the computer you are typing the command into.
So the putting localhost in the connection string simply means, "connect to the database on my computer." If you use the hostname of the computer itself it is, essentially, the same thing, but, to the computer, it looks like an external computer is accessing it.
Some hosting companies disallow accessing the database any other way then by localhost; allowing computers to access the database by the proper hostname opens the possibility of external computers on the Internet accessing the database on your machine--a potential security loophole if somebody gives a database the wrong privileges.
I would suspect that GoDaddy might set the default privileges so that no external computers can connect; users can only connect to the computer via localhost.
I have no idea what level of Linux experience you have so I apologize if I am going over stuff you already know.
John Berns
Travel Guide
Travel Photographer
Sorry, my bad...I thought I
Sorry, my bad...I thought I had written that down...but apparently didn't.
But yes, I tried connecting to localhost first. In fact, that was the first thing I did. However, it didn't work. After browsing through this forum, I found another entry where a user had a similar problem and there was a reply saying that he should try putting in the hostname given by godaddy, and that it worked fine for him.
So that's what I tried next but it still didn't work. The post, I saw however, was made in 2006 on godaddy's mysql 4.x server. I'm using mysql 5. I don't know if that's an issue...
GoDaddy's instructions
This is how GoDaddy instructs its customers to connect to the database:
//Connect To Database
$hostname='p50mysqlxxx.secureserver.net';
$username='username;
$password='your password';
$dbname='dbname';
$usertable='your_tablename';
$yourfield = 'your_field';
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
where p50mysqlxxx is a server name specified along with the hosting account (which I used).
Their tech support is not much help either saying that they don't support 3rd party etc., etc...
Remind me not to get hosting on Godaddy next time...in fact, it's not mine...it's just that my client already has an existing hosting account there and we thought to maximize its use.
Well...
someone else having problems with godaddy just posted a new topic at http://drupal.org/node/164832 using the built-in install process.
in case it helps.
Brand Design
Brand DesignReach Brands in Bristol are brand design consultants - we bring brands and consumers together.
mysql5
have you tried using the mysqli connector instead? phpinfo() should indicate which one (mysql/mysqli) is in use.
just a question on godaddy: are you required to use the @p50... string as the host? would @localhost work, as the other poster suggested? would it be possible to see what phpmyadmin is connecting with; you should be able to connect with a similar string.
NOW it's working
I just tested it again now, and it already works. Apparently, the steps I outlined above in my original post WERE the correct steps.
Maybe something was wrong with the db server yesterday...
Glad you got it working.
Glad to hear things sorted themselves out.
John Berns
Travel Guide
Travel Photographer
Thanks
Thanks John and tm for your inputs.
Very good!
maybe it was related to the separate database hosting (network).
$db_url =
$db_url = 'mysql://myusername:mypassword@localhost/mydbname';
Make sure the DB user has privileges to connect the the database via localhost. (You can check that with phpMyAdmin.)
cheers the mysqli connector
cheers the mysqli connector worked for me, managed toget it working on godaddy in the end
Hostname must be changed for GoDaddy
Hi,
I was setting up one of our www.themesnap.com themes for a customer today and was about to call up GoDaddy to ask them why they must make my life so hard :-\
Then I tried one last thing I saw another Drupal post mention. I added the hostname (server) within the expanded "Advanced Options" section while setting up this theme. So, instead of localhost, you need to go to your PhpMyAdmin in GoDaddy and copy the entire server name to place in the localhost field on your Drupal setup page. It will look something like this:
somedatabasename.db.5928941.hostedresource.com
I left the other fields blank and just entering the above worked for me.
worked for me as well
hi,
I have tried every thing in the page and only this(the last comment) worked for me...thx trueMarketing...