Jump to content

Access denied for user 'root'@'localhost' (using password: YES)


Guest kirara

Recommended Posts

hey guys,

 

I'm new here and I want to ask question about this problem (the one in the title). I don't want to be a Help Vampire but I have tried many options in fixing this problem.

 

I think this is an issue about Incorrect: Username/Password.

 

I am trying to connect to my local server with the username="root", pasword="",host="localhost",dbName="dbname";

 

I have 2 connections, One is I'm using class to connect and the other is I'm using a procedural programming. I can connect to my 2nd connection using the procedural but I can't connect to my 1st connection using classes. I'm still new to php and want to learn about it. I've tried google-ing and found any suggestions but still it doesn't work.

 

1st Connection: This one shows Error (Access is Denied)

 

<? //filename: sampleOOP.php

include('config.php');

include('classLib_inc.php');

 

echo DB_HOST . "

";

echo DB_NAME . "

";

echo DB_USER . "

";

echo DB_PASS . "

";

 

$db = new database(DB_HOST,DB_NAME,DB_USER,DB_PASS);

 

$db->_connect();

$db->_query("SELECT * FROM tblmonths");

 

$db->_numberOfRows();

?>

 

 

2nd Connection: Connection is Good

 

<?php #filename: didpconnect.php

 

$dbName = "didp";

$dbHost = "localhost";

$dbUser = "root";

$dbPass = "";

 

$conn = mysql_connect($dbHost,$dbUser,$dbPass);

mysql_select_db($dbName,$conn);

?>

 

<?php //samplePage.php

include('didpconnect.php');

global $conn;

 

$sqlSp = "SELECT * FROM tblprojects";

$qrySp = mysql_query($sqlSp,$conn) or die("ERROR:" .mysql_error());

?>

Project Type

Project

--Select Project--

<?php

while($proj = mysql_fetch_array($qrySp)){

$id = $proj['id'];

$project = $proj['project'];

Can you help me Fix this problem?

I'm still researching about this prob. I'm trying my very best to fix this.

 

Thanks,

kirara

 

More Power Killersites.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...