Problem with mysql and php

niraj.kumar.ait

New Member
Messages
15
Reaction score
0
Points
0
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error());

Above code is giving me following error :

Could not connect to MySQL: Access denied for user 'niraj'@'localhost' (using password: YES)
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Have you created a user for the database named nijar? If so, are you sure the password is correct?
 

niraj.kumar.ait

New Member
Messages
15
Reaction score
0
Points
0
Have you created a user for the database named nijar? If so, are you sure the password is correct?

Well , its not allowing me to connect to the localhost itself . This query just connect to the localhost. Yes I have a user with 'niraj' name
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Are you able to login to phpmyadmin using that username/password?
 

niraj.kumar.ait

New Member
Messages
15
Reaction score
0
Points
0
Actually I have user "nirajkum " through which I login into "www.mysite.com:2082".
Then I created a user with "niraj" to database "school" and granted all the priveleges.
Now the system has appended my user name like "nirajkum_niraj" and database to "nirajkum_school"

When I try to connect with my user

$dbc = @mysql_connect ('nirajkum_niraj', 'nirajkum_mypassword', 'localhost')

It through me exception . When I click on "phpmyadmin" . I see tat I have logged in as "nirajkum" (instead of "nirajkum_niraj"). And THE USER "nirajkum" dont have any priveleges to create a database from phpmyadmin .

I think its a privilege problem . Am I missing any thing ?? Or I need to set some privileges to "nirajkum" and "nirajkum_niraj" user
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Well I believe you can logout of phpmyadmin to test the login of other users. But anyway, if this is the function call you're using:

mysql_connect('nirajkum_niraj', 'nirajkum_mypassword', 'localhost')

then you've got the arguments mixed up. The host comes first, then the user, then the password. Right now you have the username where the host should be, the password where the username should be, and the host where the password should be.
 

niraj.kumar.ait

New Member
Messages
15
Reaction score
0
Points
0
Thanks a lots . Now it has worked
Can you help me on the following warning msg

Warning: mail() has been disabled for security reasons in /home/nirajkum/public_html/login.php on line 73

I mean how to enable mail() ?
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
You have to login to your x10hosting account and request Intermediate php configuration in order to use the mail() function. This area should be on the lower-left.
 
Top