Jump to content

connecting to database


Tylor_Famous

Recommended Posts

(Thank you for reading this!)

Ok I am still new to php and mysql and when I connect to my database I need to have something like this:

 

$dbhost = 'host';

$dbuser = 'root';

$dbpass = 'password';

$dbname = 'name';

 

Well, before when I had my database with godaddy the host was something like 123.456.78.90.secureserver.net and that worked fine. Well, I switched to a Parallels PLESK virtual server and i have to have the database there and I can't figure out what to put as the host! I tried localhost and

127.0.0.1 and even my server's ipaddress and NOTHING will work and I really need to get it working like TODAY? I need some help!

Any help you may have would be GREATLY appreciated!

Thank you in advance!

 

Here is my PHP code:

<?php
$dbhost = 'localhost';
$dbuser = 'USERNAME';
$dbpass = 'PASSWORD';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'TABLENAME';
mysql_select_db($dbname);
?> 

 

And here is my Error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'domainname'@'localhost' (using password: YES) in C:\Inetpub\vhosts\domainname\httpdocs\test\dbtest.php on line 6

Error connecting to mysql

Link to comment
Share on other sites

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.