| | |
how to connect to mysql in wamp
![]() |
•
•
Join Date: Jul 2009
Posts: 2
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?php $con = mysql_connect("localhost:3306","pm" ,""); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code ?>
on writing the above code it is showing the following error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'pm'@'localhost' (using password: NO) in C:\wamp\www\p2.php on line 83
Could not connect: Access denied for user 'pm'@'localhost' (using password: NO)
how can i solve this error.
Last edited by peter_budo; Jul 12th, 2009 at 4:19 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Jan 2008
Posts: 57
Reputation:
Solved Threads: 5
•
•
•
•
<?php
$con = mysql_connect("localhost:3306","pm" ,"");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
on writing the above code it is showing the following error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'pm'@'localhost' (using password: NO) in C:\wamp\www\p2.php on line 83
Could not connect: Access denied for user 'pm'@'localhost' (using password: NO)
how can i solve this error.
in WAMP, use this syntax for your connection establishment;
php Syntax (Toggle Plain Text)
$con = mysql_connect("localhost","root" ,""); if (!$con) { die('Could not connect: ' . mysql_error()); }
Hope it will help you...
Why you are writing port number with localhost? Also No username "pm" with password as "empty string" is registered.
Syed Ammar Hassan
" A man is known by his level of Determinism "
--------------------------------------------------------
"Some cause happiness where ever they go, others whenever They go"
--------------------------XIII---------------------------
" A man is known by his level of Determinism "
--------------------------------------------------------
"Some cause happiness where ever they go, others whenever They go"
--------------------------XIII---------------------------
![]() |
Similar Threads
- cannot connect to mysql server (PHP)
- how do I connect to MySQL server which is firewall protected? (Python)
- How to Connect MySQL from JSP Page (JSP)
- Code to connect mysql through python (Python)
- How to connect to mysql using shell script? (Shell Scripting)
- Can't connect to MySQL server on 'localhost' (10061) (PHP)
- Connect to MySQL DB w/ VB 2005 (VB.NET)
- setting up MyODBC to connect to MySQL, need help.... (MySQL)
Other Threads in the PHP Forum
- Previous Thread: How we open a ms word document file with php?
- Next Thread: use singlw query to insert record in diff tables
Views: 2186 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array arrays beginner box buttons cakephp check checkbox class cms code curl database date directory display download dropdown dynamic echo email error file files form forms function functions header hosting href htaccess html image images include insert integration ip java javascript joomla jquery limit link list login loop mail menu mlm mod_rewrite multiple mysql order parse paypal pdf php problem query radio redirect regex remote results script search select server session soap sort sorting source speed sql string structure system table tutorial update upload url user validate validation validator variable video web website wordpress xml






