PDA

View Full Version : PHP & MySQL error?


FethrdWlf
02-12-2011, 01:07 AM
Sooo.... I have installed XAMPP on my computer, which included MySQL. After that, I used EMS MySQL Manager Lite 2010 to manage/create a new database. The database name is registered_users, and it was on the host of localhost, and the name root, and no password. So pretty much, it's just the basics. Then, I went into Dreamweaver CS4 and created a new PHP file trying to connect to the database like such:
<?php

$host = "localhost";
$name = "root";
$password = "";
$database = "registered_users";

$cxn = mysqli_connect($host,$name,$password,$database)
or die ("Cannot connect to server at the moment.");

?>
All I am trying to do is let users create an account on my webpage, which at the moment does not support that due to the problem I'm having.

Whenever I try to load up the above script from the [Submit] button on my site, it always pulls up with this error:

Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'root'@'MY_IP_ADDRESS_IS_PLACED_HERE' (using password: NO) in /www/zxq.net/f/e/t/fethrdblog/htdocs/scripts/register.php on line 9

What do I need to do?....

johnMoss
02-12-2011, 10:00 PM
Local host will only work as an address from your own computer. You are trying to use the server on your computer as the database correct? You need to add your router ID into the published path to make it work, and that is a highly precarious thing to do, as in bad idea. Can you not load your PhP onto your web server?

FethrdWlf
02-12-2011, 10:17 PM
Local host will only work as an address from your own computer. You are trying to use the server on your computer as the database correct? You need to add your router ID into the published path to make it work, and that is a highly precarious thing to do, as in bad idea. Can you not load your PhP onto your web server?

No, it will transfer to my server. However, it only gives me an error when trying to use it. So, you're saying that instead of using "localhost", my IP is needed?

Heeeeellllo computer scrap-yard! If that's the case, I'll buy an old computer and set-up another server on it, for security reasons (With some other precautions).