Jump to content

Recommended Posts

Posted

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

Posted
Welcome to the forums, dchaffey!  :group:

 

Assuming you're running the shopping cart on a TCH-hosted account, the proper value for $servername is "localhost".

 

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?

Posted

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.

Posted

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

Posted (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 by GroovyFish
Posted
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

 

 

Thanks GroovyFish,

 

I did not combine the cpanel and datbase username & password. I will give that a try.

 

David

Posted
I did not combine the cpanel and datbase username & password. I will give that a try.

David

 

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!

Posted

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.

Posted
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.

 

 

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.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...