dchaffey Posted July 24, 2005 Posted July 24, 2005 I am trying to get my new shopping cart on line. I am hitting a wall. Below is the current error. I have tried my domain name, server and I.P address where it asks: // Hostname or ip of server $servername="xxxxxxxxxx"; Here is the error I am getting: Warning: mysql_connect(): Unknown MySQL Server Host 'xxxxxxxxxxxxx' (1) in /home/xxxxxxx/public_html/sunshop/admin/db_mysql.php on line 44 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/xxxxxxx/public_html/sunshop/admin/db_mysql.php on line 49 Connect Failed: Cant make connection to database. Error number: Unknown Error description: None Please ensure that the database and server is correctly configured and try again. Any help would be appreciated. Thanks Quote
TweezerMan Posted July 24, 2005 Posted July 24, 2005 Welcome to the forums, dchaffey! Assuming you're running the shopping cart on a TCH-hosted account, the proper value for $servername is "localhost". Quote
dchaffey Posted July 24, 2005 Author Posted July 24, 2005 Welcome to the forums, dchaffey! Assuming you're running the shopping cart on a TCH-hosted account, the proper value for $servername is "localhost". <{POST_SNAPBACK}> Thanks for the suggestion, I tried that, too. I am supposed to be on server10. I tried entering that and did not work either. Any other thoughts? Quote
TCH-Don Posted July 24, 2005 Posted July 24, 2005 Be sure that in MySql you 1 - created the database 2 - created a user 3 -added the user to the database Then to connect to the database in a script use: host: localhost database: yourCpanelName_databaseName user: yourCpanelName_databaseUser password: mypassword * Note password is just as the password, do not add the CpanelName to it. Quote
dchaffey Posted July 27, 2005 Author Posted July 27, 2005 Hi Guys, Thanks for all of the suggestions. I have tried everything I can think of. I will include what I can and see if anyone can make sense of it. // Hostname or ip of server $servername="localhost"; // Username and password to log onto db server $dbusername="XXXXX"; I have tried the database & Cpanel username $dbpassword="XXXXX"; I have tried the database & Cpanel password // Name of database $dbname="sunshop"; // Table prefixes. Do not change the value after the install has been finished! //$dbprefix="ss_"; // Uncomment this line if this is a new install. ?> I am getting this error message: Connect Failed: Unexpected error from the database. Error number: Error description: Please ensure that the database and server is correctly configured and try again I deleted everything in the MySQL and started over. Any Ideas??? David Quote
GroovyFish Posted July 27, 2005 Posted July 27, 2005 (edited) Are you sure you added the user to the database? Its a little unclear how you entered the information (and Don noted this all above) dbusername would be cpanelusername_databaseusername dbname would be cpanelusername_databasename dbpassword would be JUST the password for the database Edited July 27, 2005 by GroovyFish Quote
dchaffey Posted July 27, 2005 Author Posted July 27, 2005 Are you sure you added the user to the database? Its a little unclear how you entered the information (and Don noted this all above) dbusername would be cpanelusername_databaseusername dbname would be cpanelusername_databasename dbpassword would be JUST the password for the database <{POST_SNAPBACK}> Thanks GroovyFish, I did not combine the cpanel and datbase username & password. I will give that a try. David Quote
GroovyFish Posted July 27, 2005 Posted July 27, 2005 I did not combine the cpanel and datbase username & password. I will give that a try.David <{POST_SNAPBACK}> David, I am sure you just typed that wrong, but to be sure, the database password is not a combination, its ONLY the database password. Only the database username and database name are combined with the cpanelusername. Hope you get it working! Quote
erisande Posted July 28, 2005 Posted July 28, 2005 Hello! I hope I can help. I assume you have a database already created... In your CPanel, click MySQL Databases. (The attachment shows the lower part of the screen displayed.) In the Users section, enter a username and password, then click Add User. When the processing ends, go back to the same screen and select the User and DB from the drop down list (as shown at the top of this attachment), give all privs. For now, all privs is ok for testing, but you may want to change things later on. Then your SQL code on your page should be something like: >$connection = mysql_pconnect("localhost","USERNAME","PASSWORD") or die ("Couldn't connect to server."); $db = mysql_select_db("DATABASE_NAME", $connection) or die("Couldn't select database."); Ok, note: USERNAME must match the username exactly as it appeared in the drop down lists. It will look something like: [account]_[usernameyouentered] as will the DATABASE_NAME: [account]_[databasename] So for example: USERNAME = myweb_cooluser DATABASE_NAME = myweb_niftydb I hope this helps some. Quote
dchaffey Posted July 29, 2005 Author Posted July 29, 2005 Hello! I hope I can help. I assume you have a database already created... In your CPanel, click MySQL Databases. (The attachment shows the lower part of the screen displayed.) In the Users section, enter a username and password, then click Add User. When the processing ends, go back to the same screen and select the User and DB from the drop down list (as shown at the top of this attachment), give all privs. For now, all privs is ok for testing, but you may want to change things later on. Then your SQL code on your page should be something like: >$connection = mysql_pconnect("localhost","USERNAME","PASSWORD") or die ("Couldn't connect to server."); $db = mysql_select_db("DATABASE_NAME", $connection) or die("Couldn't select database."); Ok, note: USERNAME must match the username exactly as it appeared in the drop down lists. It will look something like: [account]_[usernameyouentered] as will the DATABASE_NAME: [account]_[databasename] So for example: USERNAME = myweb_cooluser DATABASE_NAME = myweb_niftydb I hope this helps some. <{POST_SNAPBACK}> Thank you for your input. I tried deleating everything and starting over. I still get to the same place. I will give it one more try. Quote
TCH-Don Posted July 29, 2005 Posted July 29, 2005 Please look at my post above and tell me at what point it does not work. Quote
dchaffey Posted July 29, 2005 Author Posted July 29, 2005 Thanks for all of your input. I pieced it all together from the input from you-all and re-ran everything. It is working!!!!!!!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.