Access denied for user 'SYSTEM'
Posted by: uldtot (---.0.fullrate.dk)
Date: October 11, 2009 12:56AM

Getting this when trying to use my mysqli database.

"Access denied for user 'SYSTEM'@'localhost' (using password: NO)"

Heres the script:

<?php
$host = "SERVERIP"; // Host name
$username = "energyhosting"; // Mysql username
$password = "MYPASSWORD"; // Mysql password
$db_name = "energyhosting"; // Database name
$tbl_name = "forum_question"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password"winking smiley or die(mysql_error());
//mysql_connect("$host", "$username", "$password"winking smileyor die(mysql_error());
mysql_select_db("$db_name"winking smileyor die("cannot select DB"winking smiley;

$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result=mysql_query($sql);
?>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>

<?php
while($rows=mysql_fetch_array($result)){ // Start looping table row
?>
<tr>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td>
</tr>

<?php
// Exit looping and close connection
}
mysql_close();
?>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td>
</tr>
</table>


The mysqlo is not hosted on same computer,. its on a lan computer.

Root password just changed with "update user set password = 'mypassowrd' where user = 'root';


anyone who can help? :/

Re: Access denied for user 'SYSTEM'
Posted by: SgtLegend (121.214.100.---)
Date: October 11, 2009 01:02AM

Your coding is wrong. It should be

$host = "SERVERIP"; // Host name
$username = "energyhosting"; // Mysql username
$password = "MYPASSWORD"; // Mysql password
$db_name = "energyhosting"; // Database name
$tbl_name = "forum_question"; // Table name

// Connect to server and select databse.
$link = mysql_connect("$host", "$username", "$password"winking smiley or die(mysql_error());
//mysql_connect("$host", "$username", "$password"or die(mysql_error());
mysql_select_db("$db_name", $link) or die("cannot select DB"winking smiley;

$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result=mysql_query($sql, $link);

Re: Access denied for user 'SYSTEM'
Posted by: uldtot (---.0.fullrate.dk)
Date: October 11, 2009 01:10AM

Still getting: Access denied for user 'SYSTEM'@'localhost' (using password: NO)

The coding works on another server. But your code is more correct grinning smiley



Edited 2 time(s). Last edit at 10/11/2009 01:26AM by uldtot.

Re: Access denied for user 'SYSTEM'
Posted by: uldtot (---.0.fullrate.dk)
Date: October 11, 2009 01:17AM

hmm now i cannot login to phpmyadmin anymore ... (with root)

::::UPDATE: Im back into phpmyadmin.. reset passowrd... still getting the error



Edited 2 time(s). Last edit at 10/11/2009 01:26AM by uldtot.

Re: Access denied for user 'SYSTEM'
Posted by: uldtot (---.0.fullrate.dk)
Date: October 11, 2009 01:59AM

Now i read this: [forum.wampserver.com]
And folowed the guides on JLBN´s website..

Now i got phpadmin login (real one, not just the .htaccess looking one smiling smiley


Checked username / password , tryed different users. All same error. Even if i set $host to '' it still show the error.

UPDATE: After trying a lot. i tryed to turn of PHP safe mode.. now i got a new message:


"php_network_getaddresses: getaddrinfo failed: No such host is known"

And turned php display errors on then it showed this:
"Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\forum\main_forum.php on line 10

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is kn (trying to connect via tcp://$host:3306) in C:\wamp\www\forum\main_forum.php on line 10

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\forum\main_forum.php on line 10
php_network_getaddresses: getaddrinfo failed: No such host is known. "



UPDATE AGAIN: Now the server crash every time i load the script. "php_mysql.dll"



Edited 2 time(s). Last edit at 10/11/2009 02:20AM by uldtot.

Re: Access denied for user 'SYSTEM'
Posted by: uldtot (---.0.fullrate.dk)
Date: October 11, 2009 02:39AM

Now sometihng changed: i reinstalled wamp. (deleted all and only saved my WWW.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'energyhosting'@'localhost' (using password: YES) in C:\wamp\www\forum\main_forum.php on line 10
Access denied for user 'energyhosting'@'localhost' (using password: YES)

^^ now it show the user i am trying to connect with in the database. now i just need to setup everything else again.

Re: Access denied for user 'SYSTEM'
Posted by: yfastud (Moderator)
Date: October 11, 2009 04:26PM

download resetmysql here
[downloads.jlbn.net]

to setup password, follow this
[blog.jlbn.net]

to setup db account, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Sorry, only registered users may post in this forum.