1,105,625 Community Members

connection problem php to mysql

Member Avatar
momonq1990
Junior Poster in Training
61 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

error msg: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mon'@'localhost' (using password: YES) in C:\xampp\htdocs\project\include\connection.php on line 7
Could not Connect


///my connection.php code
<?php
define("contype","localhost");
define("user","mon");
define("passwd","affinity");
define("db","project");

$con=mysql_connect(contype,user,passwd) or die('Could not Connect');
$dbcon=mysql_select_db(db);
?>

//here's my scenario. i add new USER to my mysql in phpmyadmin and its username=mon, password=affinity + function(password) then i cant connect using this account... but using root account, works fine... help guys.

Member Avatar
rch1231
Veteran Poster
1,187 posts since Sep 2009
Reputation Points: 131 [?]
Q&As Helped to Solve: 194 [?]
Skill Endorsements: 13 [?]
 
1
 

Did you give the user privileges to access the database projects?

Member Avatar
momonq1990
Junior Poster in Training
61 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

yes i give privileges select insert delete update create drop. and i also reload that... :(

Member Avatar
momonq1990
Junior Poster in Training
61 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

yes i got it.. i found my mistake :) thanks dude for pointing me near to my error... i found in my mysql>user my host is also mon instead of localhost thanks

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article