i wrote <?php mysql_connect("localhost", "admin", "1admin") or die(mysql_error()); echo "Connected to MySQL<br />"; ?> i found error Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in C:\wamp\www\s\c1.php on line 10 Access denied for user 'admin'@'localhost' (using password: YES I am very new in PHP Mysql
default would be username Root with no password, but the error suggests that you edited the config file within the phpmyadmin program, did you do that ?
maybe you shoud GRANT admin user in mysql like this: > GRANT ALL on yourdb.* to admin@localhost identified by '1admin';
use this code and change 'type password here' and give correct password or if you use simple wamp server than ('localhost','root','') use <?php mysql_connect('localhost','root','type password here') or die('Not connected to server'); mysql_select_db('databasename') or die("NOT selected DB"); ?>
Hi, I suggest you that if you are new then you use Just like that, <?php $connection = mysql_connect("localhost", "root", " ") or die(mysql_error()); ?> Because here we use all Parameter which is consider as a Default, but if you want to run your own code then, first you go Privilege,in PHPMYAdmin section[MySql Section], here you have an Authority that, You create a new user as you want to do later you try and get you Success with your native code. <?php mysql_connect("localhost", "admin", "1admin") or die(mysql_error()); echo "Connected to MySQL<br />"; ?>