Jump to content


Photo

mysql - password error


  • Please log in to reply
3 replies to this topic

#1 reidesign

reidesign

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 28 December 2006 - 01:13 AM

I'm receiving this error:

PHP Fatal error: Access denied for user 'root'@'localhost' (using password: NO) in /home/.sites/85/site23/web/Connections/MineWorks.php on line 9

Here's the code:

<?php require_once('Connections/MineWorks.php'); ?>

<?php

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;



switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}



$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}



if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

$insertSQL = sprintf("INSERT INTO test (`first`) VALUES (%s)",

GetSQLValueString($_POST['first'], "text"));



mysql_select_db($database_MineWorks, $MineWorks);

$Result1 = mysql_query($insertSQL, $MineWorks) or die(mysql_error());



$insertGoTo = "success.php";

if (isset($_SERVER['QUERY_STRING'])) {

$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

$insertGoTo .= $_SERVER['QUERY_STRING'];

}

header(sprintf("Location: %s", $insertGoTo));

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR...ml4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

</head>



<body>

<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">

<table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td>first</td>

<td><input name="first" type="text" id="first" value="first" maxlength="25"></td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td><input type="submit" name="Submit" value="Submit"></td>

<td> </td>

</tr>

</table>

<input type="hidden" name="MM_insert" value="form1">

</form>

</body>

</html>

Here's my Connection file:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_MineWorks = "localhost";
$database_MineWorks = "mineworks";
$username_MineWorks = "root";
$password_MineWorks = "";
$MineWorks = mysql_pconnect($hostname_MineWorks, $username_MineWorks, $password_MineWorks) or trigger_error(mysql_error(),E_USER_ERROR);
?>

When I set my connection in Dreamweaver MX I'm using localhost for mysql server, root for user and pw is left blank.

When I use the page locally and check the table, the information is stored. When I try to use the page remotely, I don't see anything but a blank white page. My hosting company told me what the error message is they received.

Any suggestions?
Thanks,
Reid

#2 MrX

MrX

    The Mad Theorist

  • Support Team
  • PipPip
  • 167 posts
  • Location:IRC :P
  • Wiki ID: MrX
  • IRC Nickname: MrX, MrX- and MrX_

Posted 28 December 2006 - 09:55 AM

Maybe your hosting company is using a different mySQL password?

#3 reidesign

reidesign

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 28 December 2006 - 10:40 AM

Maybe your hosting company is using a different mySQL password?


As I'm very new to php mysql etc., please be patient.

I'm using Dreamweaver and when I create the page, I use the settings for my testing server (on my machine). Should I then change the settings to the user id and pw as per the hosting information?

Thanks.

#4 olajideolaolorun

olajideolaolorun

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 2,347 posts
  • Gender:Male
  • Location:Atlanta, GA
  • SourceForge IDempirex
  • Wiki ID: olajideolaolorun
  • IRC Nickname: Olajide
  • Main OS: Windows 10

Posted 28 December 2006 - 01:28 PM

A. Moved the topic.

From what i understand, you are not getting that error on Uniform Server but from your hosted server online.

If thats the case, then contact your hosting company for your mysql username and password. Make sure you import the database also if you have too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users