Hello.

I am using Easy php

i am trying to connect with the following code

<?php
$con = mysql_connect("localhost","admin","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
?>

getting error as follows

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: NO) in C:\Program Files\EasyPHP 2.0b1\www\test1.php on line 2
Could not connect: Access denied for user 'admin'@'localhost' (using password: NO)

Recommended Answers

All 9 Replies

Apparantly you need to provide a password to connect to mysql. It is missing on line 2.

yes i got it through the admin page ..i used "root" instead of "admin"

Member Avatar for rajarajan2017

Yes root without password will work. Please mark it as solved if solved.

the username should be root if you use the default
mysql_connect("localhost","root","")

a question..how to set the password

Member Avatar for rajarajan2017

See the attachment

you can update the password also...

run this query in database 'mysql'->table 'user'

update user set Password = md5('12345') where user = "root";

above query update the user 'root' with password '12345'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.