First off, this is the error message I'm getting:
"Warning: mysql_connect(): Access denied for user: 'xxxx@xxxxxx.com' (Using password: YES) in /home/xxxx/public_html/includes/database.mysql.inc on line 31
Access denied for user: 'xxxxx@xxxxxx.com' (Using password: YES)"
I've checked over and stared at the two lines in sites/default/settings.php a number of times, and can't find anything that is wrong. I've deleted and recreated the appropriate database and user several times just to make sure there wasn't a problem with that, but no luck.
This is especially frustrating because I have sucessfully installed drupal 4.6 on a different website (lets call it site A), and this site (site B) was working until I decided to reinstall drupal to fix a problem it was having.
Basically, the story is this:
-I have to create a website for a university project, but the client was slow in getting us the webspace so I started creating the website on my personal webspace (site A).
-Everything was going great at this point, all working just fine.
-Finally get webspace from client, and thought to save time perhaps I could just copy and paste all the files from the first drupal installation (site A) on my website over to the new website (site B).
-This seemed to work fine until I realized that even though i would start out and log in at the address for the new website (site B), the pages would all redirect to the old website (site A), which was obviously a problem as I am not prepared to host this thing indefinately, plus a variety of other reasons.
-In order to fix this problem, I decided to just recreate everything - I deleted all the drupal files on the second website (site B), and did a clean upload of a fresh copy of 4.6.
-I set up the database and users the same way as before, but now I am stuck with this error message that I can't resolve on site B.
I've spent many hours comparing every line of code between the working (site A) and non-working (site B) versions in settings.php, and I can't see where the problem is. As a last resort I tried to delete everything from site B again and copy everything from site A the way I did initially, and it doesn't change the error message.
I don't know what to do!
Comments
MySQL woes
Hi,
Can you connect to the database using that same user in with a non-Drupal website? Alternatively, can you log-in directly to the database (not through a web interface) with that user? Or are you going through phpmyadmin?
It sounds to me like it is the MySQL user that is the problem, but your comment:
suggests otherwise.
Also, you mention that you've really gone through the code with rigor, but one culprit that gets me sometimes--being an old VB guy--is case sensitivity.
Finally, with hosted accounts, my experience has been that the acct name is prefixed to the user and database, so if your original site was user A, you'd have a db url like:
$db_url = 'mysql://My_Account_Name(A)_username:password@localhost/My_Account_Name(A)_databaseName';But on the new site (B) it'd be:
$db_url = 'mysql://My_Account_Name(B)_username:password@localhost/My_Account_Name(B)_databaseName';EDIT: After reading your post again, I'm also thinking that your original copy/paste method was fine (bullet 3 or 4)... but then just change the $base_url in the settings.php and you should have a working site.
If these things are horribly obvious, I apologize.
Best of Luck.
thanks for the pointers. I
thanks for the pointers. I can't say if I've actually made any progress other than that I've narrowed it down to the specific line:
$db_url = 'mysql://username:password@localhost/database';i tried one more time wiping everything and starting from scratch, installing Drupal 4.6.6 (i'd had a version of 4.5 before), followed the directions exactly, same problem. however, when I chaged the line :
$base_url = 'http://localhost';to point at site B instead of site A, while leaving the database URL (above) pointing at the login and database for site A, it works, and this time when I log in the domain stays at site B instead of returning to site A.
Interestingly, I can now view themes I have uploaded to site B (but not site A) on site B and change them, but this chage also affects site A (not really surprising).
So basically, I've narrowed down the problem to specificially the line of code that accesses the database (i was pretty sure that was the problem anyway), but i just can't see how i keep retyping that line wrong, especially with the number of times i've not erased and retyped it, and the number of times i changed the names of the user, the database, and the password...
I'm wondering if i should contact my virtual host about it since it's possible it's a problem on their side (I know it should work because both site A and site B are hosted by the same company)
Server & Privileges
Hi,
Is the msql-server running :(? If yes, privileges for the user are incorrect.
GRANT ALL PRIVILEGES ON database.*
TO user@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database.*
TO user IDENTIFIED BY 'password';
/q
Then try to login from the command line using your new user and password
mysql -u USER -pPASSWORD
Privileges
i'm using cPanel and phpMyAdmin to set everything up. I've never used just straight mySQL code before. However, I checked in cPanel, and the user does in fact have ALL privileges. Could it be anything else in the way I've set things up?
This is the way I set up the database:
In cPanel "MySQL Account Maintenance":
1) Create user XX with password XY
2) Create database ZZ
3) Add user XX to database ZZ with ALL privileges
In phpMyAdmin:
1) select database siteB_ZZ (-)
2) select SQL tab
3) run SQL query from the database/database.mysql file in the Drupal 4.6.6. directory on my computer
In siteB/sites/default/settings.php:
1) change this line:
$db_url = 'mysql://username:password@localhost/database';to read:
$db_url = 'mysql://siteB_XX:XY@www.siteB.com/siteB_ZZ2) save changes
Then I go to view the page, and get the error I originally stated.
Hopefully that will be more helpful.
cpanel
User isn't being added for some reason.
I will be online for awhile, send me a email if you want someone to take a look.
Have you tried:
$db_url = 'mysql://siteB_XX:XY@localhost/siteB_ZZ';
THANKS!
that seems to have done the trick, thank you!
MySQL user accounts
Keep in mind that user@localhost is a different MySQL user account than user@xxxx.com. If you've granted rights to user@localhost, but try to connect as user@xxxx.com, you won't be able to.
Generally the hostname for the database server is always localhost unless your web server and database server are actually installed on different machines.
--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal
This was the resolution to my problem
Thanks for the resolution to the issue I was having with this problem. I was recreating a development server environment on my laptop. I export the database and downloaded the site from source respository. I could connect with the root but not the original user. I tried deleting and recreating it, also. Thanks again.