|
|
|
|
![]() ![]() |
Jun 4 2006, 11:39 AM
Post
#1
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
I'm trying to run one of my scripts on my website and its giving me this error:
QUOTE Warning: mysql_connect(): Access denied for user: 'lonebyrd_@localhost' (Using password: YES) in /home/lonebyrd/public_html/login.php on line 2 Access denied for user: 'lonebyrd_@localhost' (Using password: YES) Is there another password for MySQL other than the one I use for my site that I just don't know how to access? |
|
|
|
Jun 4 2006, 12:30 PM
Post
#2
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
There's something wrong with your MySQL Username.. When you create a new MySQL DB from cPanel, your database name and your db username are both prefixed with your cPanel username.
For example, if your cPanel username is lbyrd, and you create a MySQL database called mydb then your actual database name (that you're supposed to use in scripts) will be lbyrd_mydb. Similarly, the username you create to access this db will be prefixed by lbyrd_ too.. for example if your username was mydbuser then the actual username to use in scripts will be lbyrd_mydbuser. If you notice that in your script your username appears only as lonebyrd_ - i.e. it contains only your cPanel username but not the actual db access username that should come after the "lonebyrd_". |
|
|
|
Jun 4 2006, 03:02 PM
Post
#3
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
I'm still not getting it to work. Maybe it's just something I'm missing but I've checked it a couple of times and I cant figure out why it's not working. Should I have to make a seperate username in my script for both my db and site? I.E. $dbusername: lonebyrd_ $username: lonebyrd
|
|
|
|
Jun 4 2006, 03:18 PM
Post
#4
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
I'm still not getting it to work. Maybe it's just something I'm missing but I've checked it a couple of times and I cant figure out why it's not working. Should I have to make a seperate username in my script for both my db and site? I.E. $dbusername: lonebyrd_ $username: lonebyrd It's not possible to say without seeing the code. Post the code here - the part that you've written to connect to the database. Also tell me your database name and the username you've created to access it. P.S. Don't forget to remove the password when you're pasting the code here. |
|
|
|
Jun 5 2006, 12:58 PM
Post
#5
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
Ok.. My database name is lonbyrd_FTV and I know the username is lonebyrd_. Here are the two codes I use:
Config.php CODE <?php $user = "lonebyrd_"; $password = "password"; $database = "lonebyrd_FTV"; $host = "localhost"; ?> Login.php CODE <?php mysql_connect($user, $password, $host,) or die (mysql_error()); mysql_select_db($database) or die (mysql_error()); ?> I just thought of something. Is it because of the order I put things in my Config.php file? Well, I'm just grasping at straws, but I'll try that. |
|
|
|
Jun 5 2006, 07:22 PM
Post
#6
|
|
|
Advanced Member Group: Members Posts: 190 Joined: 16-February 06 From: Egypt Member No.: 11,326 |
Ok.. My database name is lonbyrd_FTV and I know the username is lonebyrd_. Here are the two codes I use: Config.php CODE <?php $user = "lonebyrd_"; $password = "password"; $database = "lonebyrd_FTV"; $host = "localhost"; ?> Login.php CODE <?php mysql_connect($user, $password, $host,) or die (mysql_error()); mysql_select_db($database) or die (mysql_error()); ?> I just thought of something. Is it because of the order I put things in my Config.php file? Well, I'm just grasping at straws, but I'll try that. I think the code should be like this: CODE <?php $user="lonebyrd_lonebyrd"; $password="password"; $database="lonebyrd_FTV"; $host="localhost"; ?> but don't forget to include this file in login.php or else, how should login.php know what are username, password and database name? |
|
|
|
Jun 5 2006, 08:51 PM
Post
#7
|
|
|
Guilty Until Proven Innocent Group: Members Posts: 372 Joined: 13-April 05 Member No.: 3,937 |
I think the code should be like this: CODE <?php $user="lonebyrd_lonebyrd"; $password="password"; $database="lonebyrd_FTV"; $host="localhost"; ?> but don't forget to include this file in login.php or else, how should login.php know what are username, password and database name? Yup, I agree with XIII becoz it is clearly seent that you have put the wrong username. -- you can also use this CODE <?php $user="lonebyrd"; $password="password"; $database="lonebyrd_FTV"; $host="localhost"; ?> which is your lonebyrd your username in the control panel and password is the control panel password. 3 Cheers! |
|
|
|
Jun 5 2006, 11:32 PM
Post
#8
|
|
|
Advanced Member Group: Members Posts: 190 Joined: 16-February 06 From: Egypt Member No.: 11,326 |
Yup, I agree with XIII becoz it is clearly seent that you have put the wrong username. -- you can also use this CODE <?php $user="lonebyrd"; $password="password"; $database="lonebyrd_FTV"; $host="localhost"; ?> which is your lonebyrd your username in the control panel and password is the control panel password. 3 Cheers! It's not a solution, it will not solve anything, this is the code he uses from the begining, always the username in mysql comes prefixed with Cpanel username and that's why i told him to put username_username, i would also suggest to create another user from mysql control on Cpanel, include it in this database, that will make it easier for him, also not to include configuration file in login.php |
|
|
|
Jun 6 2006, 01:33 AM
Post
#9
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
Creating a new user and password in Cpanel for MySQl did the trick. After I did that, and included put the login.php in my script instead of a seperate file, everything worked fine. Thanks for the advice. Granted, I still have problems in my script, which I knew about, but at least my page works now.
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 5th December 2008 - 12:00 AM |