Jump to content

Recommended Posts

I am dabbling in php and I'm far from a pro. This simple database connect is baffling me and it should simply just work.

 

This is the error I get. Can anyone suggest what I can do to fix this?

 

Warning: mysql_connect(): Access denied for user 'therez_db'@'localhost' (using password: YES) in /home2/therez/public_html/rez/includes/mysql.class.php on line 128
Database error 0:
linkID == False. Connect failed.
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home2/rez/public_html/therez/includes/mysql.class.php on line 131
Database error 0:
Cannot use database 'therez_db'.

 

The username and password are both valid!

 

Thank you in advance!

 

James

Edited by AceOfJames
Link to comment
https://forums.phpfreaks.com/topic/300987-mysql-user-not-connecting/
Share on other sites

are you sure of the database server hostname for the new domain? it may in fact be different from any previous domain.

 

are you sure of the database username and database name? a lot of web hosting requires the hosting account name as part of the database username.

 

after you created the database username/password, did you assign that database username privileges to the database you are trying to use?

what tool/software are you using to assign privileges to the database? you may need to explicitly flush the privileges to get them to take effect.

 

another possibility is if you have a typo or some white-space as part of the value(s) in the php code.

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.