Wierd PHP error

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Wierd PHP error

Postby dungeon keeper » 09. February 2009 11:46

Hi,

I got this problem when trying to connect to mySQL database using mysql_connect(); function.

At first everything was fine, i was able to connect and manipulate the data, no problems. But then i changed username, and password to connect to database as a different user (I created another user for database), and i get error for last username i used with this function. I deleted that user from database because it was only a test username. I created new one, but function is still trying to connect with old username even i specified new one.

So for example,

At first i was trying:


$server = "myserver";
$username = "Guest";
$password = "Guest";
mysql_connect($server, $username, $password);


And i connected normally.

I deleted this guest user from database and created new one.

$server = "myserver";
$username = "Newuser";
$password = "Newpass";
mysql_connect($server, $username, $password);


And i get error:

Warning: mysql_connect() [function.mysql-connect]: Host 'Guest' is not allowed to connect to this MySQL server in C:\xampp\htdocs\mysite\connection.php on line 9
Host 'Guest' is not allowed to connect to this MySQL server


The username is "Newuser" but i still get error for 'Guest'.

I reinstalled XAMPP because of this problem, restarted my PC but i still have same problem :?
dungeon keeper
 
Posts: 5
Joined: 08. February 2009 22:53

Re: Wierd PHP error

Postby Wiedmann » 09. February 2009 12:09

Host 'Guest' is not allowed to connect to this MySQL server

but function is still trying to connect with old username even i specified new one.

"Host" != "username".

Code: Select all
$server = "myserver";

You should use "localhost" as servername, if you want connect to your local MySQL server.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Wierd PHP error

Postby dungeon keeper » 09. February 2009 12:18

Thank you it works with localhost.

So if i put my DNS for my IP it wont work?

Edit: But the wierd thing is that it woked before and now it wont work
dungeon keeper
 
Posts: 5
Joined: 08. February 2009 22:53

Re: Wierd PHP error

Postby Wiedmann » 09. February 2009 13:29

But the wierd thing is that it woked before and now it wont work

This depends on, how you create the MySQL user (the host part for this user).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 122 guests