Jump to content
xisto Community
Sign in to follow this  
lonebyrd

Do You Need A Seperate Password For MySQL ?

Recommended Posts

I'm trying to run one of my scripts on my website and its giving me this error:

Warning: mysql_connect(): Access denied for user: 'lonebyrd_@localhost' (Using password: YES) in /home/lonebyrd/public_html/login.php on line 2Access 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?

Share this post


Link to post
Share on other sites

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_".

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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. :(

Share this post


Link to post
Share on other sites

Ok.. My database name is lonbyrd_FTV and I know the username is lonebyrd_. Here are the two codes I use:

Config.php

<?php$user = "lonebyrd_";$password = "password";$database = "lonebyrd_FTV";$host = "localhost";?>

Login.php
<?phpmysql_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.

Share this post


Link to post
Share on other sites

Ok.. My database name is lonbyrd_FTV and I know the username is lonebyrd_. Here are the two codes I use:

 

Config.php

<?php$user = "lonebyrd_";$password = "password";$database = "lonebyrd_FTV";$host = "localhost";?>

Login.php

<?phpmysql_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:

 

<?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? :(

Share this post


Link to post
Share on other sites

 

I think the code should be like this:

 

<?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

 

<?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!

Share this post


Link to post
Share on other sites

Yup, I agree with XIII becoz it is clearly seent that you have put the wrong username.

 

--

 

you can also use this

 

<?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 :(


Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.