View Full Version : SQL connection problems
merrinathletic.com
07-17-2007, 08:44 AM
I'm in the process of moving my companies web site over to BlueHost and have ran into a little bit of a road block. I imported the SQL databases however I have been unable to connect them. When I go to what should be the home page (index) I am greeted with this message:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'merrin2_user'@'localhost' (using password: YES) in /home/merrinat/public_html/upgrade/DB/drivers/adodb-mysql.inc.php on line 319
Failed to connect to db.
I do not know how to resolve this. I would appreciate any help I could get regarding this. Thanks!
merrinathletic.com
07-17-2007, 11:39 AM
I've done extensive viewing of the forum threads and FAQ and still cannot find the answers I am looking for. I'm getting super frustrated with this. Please, if there is someone that knows how to fix this problem I need help asap. This issue is driving me insane. I don't know where to change whatever needs changed to get this SQL database linked up properly.
I noticed my global.inc file had my previous server listed so I changed it to Bluehost but that didn't seem to do anything.
I have inspected the file that the error message references but can't seem to make any sense of it.
I'm not a complete idiot when it comes to these things but I'm not having any luck at all and my clock is ticking. Anyone that has experience with this, please give me some guidance. Thanks in advance to anyone who can help.
areidmtm
07-17-2007, 11:47 AM
When you created the database, did you also add the user to the database?
merrinathletic.com
07-17-2007, 11:59 AM
I added a new user to the database.
areidmtm
07-17-2007, 12:07 PM
I'm assuming that that gave that user the specific permissions to that database then it should work given that the password was entered in correctly.
merrinathletic.com
07-17-2007, 12:16 PM
"Should" being the operative word because it is not working. I set up the user with all permissions but it is still not making the connection. :confused:
The old server which I exported the database from had a different username/password then the one I set up on this server. Could that be the issue? Is there somewhere that this needs to be edited to reflect the new user name/password?
areidmtm
07-17-2007, 12:59 PM
Did you export your old database in an .sql file? If so you can use phpmyadmin to import the database.
Also, is this script located on bluhosts servers or your old one? If it's not on bluehost and you're trying to remotely access the database from another place, you need to add the IP thought the firewall.
Add the IP in cPanel>>Remote MySQL and in your customer profile, https://www.bluehost.com/dm/profile_cust.html
merrinathletic.com
07-17-2007, 01:42 PM
I did export to a .sql file and I did import it through phpadmin.
I didn't place the actual .sql file on the bluehost server though (I'm assuming it does that when I import it?). I cannot not find the .sql file by looking through it in an ftp program. Would it help if I place the actual .sql file directly on the server through FTP? If so, where?
I am not trying to use remote access, I want it to work all on this server.
areidmtm
07-17-2007, 01:56 PM
Try resetting up the user. If it still doesn't work, I don't know what to tell you. I don't know how the database, code and users are setup on your end. Assuming that you set up everything correctly, as it sounds like to me you did, then it should work.
The only other option would be to contact bluehost support.
Pethens
07-17-2007, 02:09 PM
The old server which I exported the database from had a different username/password then the one I set up on this server. Could that be the issue? Is there somewhere that this needs to be edited to reflect the new user name/password?
Yes, there is a config file somewhere with these settings that needs to be edited. If you can't find out where from the person who set up the site in the first place, start at index.php and check all the files it includes. Or look for a file with a likely name. Setting the host, database name, user, and password in this file to the right values will get you connected.
merrinathletic.com
07-17-2007, 02:50 PM
Unfortunately I am unable to contact the developer of the site so I guess I'll have to plug and chug until I find these settings to change. I've already checked several places without any luck, I was hoping there was a universal place that someone knew of that would contain the settings. Thanks to both of you for your help! Now if you'll excuse me, I have a long night of code reading ahead of me. :(
merrinathletic.com
07-17-2007, 03:13 PM
Ahhhaa!! I found the connect file, oddly enough it was named "connect.php" (yes, I am an idiot). However I've made what seems to be the appropriate changes and I'm still getting the same results. Here is what the original file said:
<?php
//For Remote Server
$db=mysql_connect("localhost","merrin2","********");
mysql_select_db("merrin2_",$db);
//For Local Server
//$db=mysql_connect("localhost","","");
//mysql_select_db("blueline",$db);
//mysql_select_db("dbmerrin",$db);
?>
Here is what I changed it to, to no avail:
<?php
//For Remote Server
$db=mysql_connect("localhost","merrina","******");
mysql_select_db("merrinat_",$db);
//For Local Server
//$db=mysql_connect("localhost","","");
//mysql_select_db("merrinat_merrinat",$db);
//mysql_select_db("merrinat_merrindb",$db);
?>
Ideas?
merrinathletic.com
07-17-2007, 03:37 PM
The area of the file (adodb-mysql.inc.php) the error points to when I try to access the home page has the following code:
// returns true or false
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (ADODB_PHPVER >= 0x4300)
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPasswo rd,
$this->forceNewConnect,$this->clientFlags);
else if (ADODB_PHPVER >= 0x4200)
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPasswo rd,
$this->forceNewConnect);
else
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPasswo rd);
if ($this->_connectionID === false) return false;
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
}
I'm not sure if this needs adjusted as well or not? Ideas?
Pethens
07-17-2007, 04:19 PM
<?php
//For Remote Server
$db=mysql_connect("localhost","merrin2","********");
mysql_select_db("merrin2_",$db);
?>
That's the code you need to change. To get the right values for user name and database name, go to cPanel > Databases > MySQL Databases.
If your bluehost username is merrinat, the database name will be merrinat_db, or something like that. The user name will be merrinat_user, or something like that. So you end up with
<?php
//For Remote Server
$db=mysql_connect("localhost","merrinat_user","********");
mysql_select_db("merrinat_db",$db);
?>
(with the correct values you get from cPanel of course).
merrinathletic.com
07-17-2007, 05:23 PM
This is getting frustrating. I changed the code, adding in the correct values (and several other variations) to no avail. I still get the exact same error message no matter what I do to the connect.php file:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'merrin2_user'@'localhost' (using password: YES) in /home/merrinat/public_html/upgrade/DB/drivers/adodb-mysql.inc.php on line 319
Failed to connect to db.
Now I changed the connect.php file to read:
<?php
//For Remote Server
$db=mysql_connect("localhost","merrinat_merrina","******");
mysql_select_db("merrinat_merrinat",$db);
?>
That includes the correct user name (merrina), the correct password, and the correct database name (merrinat). Yet, I still get the error code above. Uggh. The error mention references "merrin2" which was the user name (merrin2@localhost) on the old server (as opposed to current: merrinat@ocalhost). I'm not sure why it does that but I suppose that may be the reason it is still not connecting. But where do I look to change that value? I read the entire php file the error message references (adodb-mysql.inc.php) but there is nothing there that indicated "merrin2" or anything like that.
Pethens
07-17-2007, 05:38 PM
Well, you would hope the programmer would only set the password in one place, but apparently not. Easiest thing might be to do a global search and replace for the old username and password. It won't occur in your adodb functions, but in the code that calls those functions.
merrinathletic.com
07-17-2007, 06:11 PM
Excuse my ignorance but what is the best way to go about doing a global search? I'm a little new at this. Thanks.
merrinathletic.com
07-17-2007, 07:29 PM
Well Pethens, you were right. There was another connection file that needed changed. Once I located it and changed it, the website is now fully functional!! It took all day but, alls well that ends well!! Thanks to all of you who took the time to share your knowledge, I appreciate the help.
John
pascal
12-09-2010, 02:37 AM
Hi Dear John!
I see that it has been a long time ago that you solved your database connection problems,
but I am experiencing the same problem of access denied when i try to connect to my database on a bluehost server!
"Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'pascalmp_pascalm'@'localhost' (using password: YES) in /home2/pascalmp/public_html/conn.inc.php on line 2
I cannot connect to the database because: Access denied for user 'pascalmp_pascalm'@'localhost' (using password: YES)"
which is that other file you had to change for your website to function normally?
Thank you in advance for your time!
Cheers
Pascal
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.