phillystyle123
asked on
running mysql on godaddy server - can't connect to my db
MySQL and PHP are both running on my godaddy windows server. I've successfully installed the MySQL DB and I can run php on the server. HOWEVER when I try to connect a page to the MySQL db - no dice - this is what my connection file looks like:
<?php
# FileName="Connection_php_m ysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_mbb = "xxx.hostedresource.com";
$database_mbb = "xxxwebsitedb";
$username_mbb = "xxxwebsitedb";
$password_mbb = "xxxx";
$mbb = mysql_pconnect($hostname_m bb, $username_mbb, $password_mbb) or trigger_error(mysql_error( ),E_USER_E RROR);
?>
and this is how i'm connecting:
<?php require_once('Connections/ mbb.php'); ?>
now, i built this site on a linux server and have no problems with the connection or any other bugs -
<?php
# FileName="Connection_php_m
# Type="MYSQL"
# HTTP="true"
$hostname_mbb = "xxx.hostedresource.com";
$database_mbb = "xxxwebsitedb";
$username_mbb = "xxxwebsitedb";
$password_mbb = "xxxx";
$mbb = mysql_pconnect($hostname_m
?>
and this is how i'm connecting:
<?php require_once('Connections/
now, i built this site on a linux server and have no problems with the connection or any other bugs -
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
See my comment below for the full solution - but this code works to make the connection in godaddy - it just took me an extra step and then i created an external file
Interesting. the only time I've seen that error message is when either the PHP MySQL driver or the MySQL server were really new versions that weren't compatible with an older one. My program runs from the Godaddy server and from my own IIS5.0 server to connnect to the MySQL server on Godaddy. I set my database up for external access.
The only real difference between my code and the code above is the 'die' part after the connect statement. And I'm using 'mysql_pconnect' (persistent) where you're using 'mysql_connect'.
The only real difference between my code and the code above is the 'die' part after the connect statement. And I'm using 'mysql_pconnect' (persistent) where you're using 'mysql_connect'.
ASKER
1. I found this godaddy help article and created a test page with the connection info on the same page (not a separate file):
http://help.godaddy.com/topic/67/article/3351
2. After doing this, I got this error:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
So, I logged on to phpMyAdmin and ran this command:
SET PASSWORD FOR user@localhost = OLD_PASSWORD('password');
The reasons for doing so can be found here:
http://geekswithblogs.net/TimH/archive/2005/10/31/58591.aspx
3. Then - since set up an external file originally to handle my connection - and it no longer worked when I migrated to godaddy - I made adjustments and this is what my external file looks like (that works with godaddy):
<?php
$hostname="xxx.hostedresou
$username="myusername";
$password="mypassword";
$database_mbb="mydatabase"
$con = mysql_connect($hostname,$u
?>
4. then in my php file I put this at the top:
<?php require_once('Connections/
<?php
mysql_select_db($database_