Forum Moderators: coopster

Message Too Old, No Replies

local host not allowed to connect

is this a firewall problem?

         

httpwebwitch

4:24 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've just installed Apache, PHP, MySQL. Apache and PHP are working fine, but the mySQL is not. I am running Windows XP Home Edition. help!

Here is the error:

Warning: mysql_connect(): Host 'localhost' is not allowed to connect to this MySQL server in c:\web\test_mysql.php on line 20
1130: Host 'localhost' is not allowed to connect to this MySQL server

the line 20 in question is just this:
$connection = mysql_connect($host,$username,$password);

I have been using the instructions I found here:
h**p://internetmaster.com/installtutorial/configure_mysql.htm

Are you familiar with this error message? How to I get rid of it?

digitalv

4:31 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't answer your question, but I would advise against getting rid of it as it's there for security. Your SQL server should be a different machine from your web server and you should also configure your web server so localhost cannot connect to it as well.

If I told you how easy it was to spoof an IP address you would probably need a new pair of pants. Often times people don't make security considerations for 127.0.0.1 because they assume that the only way someone could access the server from that IP was if they were sitting AT the server - in which case they would be logged on as a user who had permission to do whatever they were doing, etc. That mentality is what causes people who THINK their systems are secure to get hacked time and time again. All I have to do is modify my outbound packets so the originating IP address is 127.0.0.1. I won't get a REPLY from your server, but if I know what is there and what I'm supposed to expect I can figure out what information to SEND to you with that spoofed IP address to either do what I want or give another IP address (my real IP) access to what I want and then remove it later.

It will also be COMPLETELY untraceable unless you were able to catch me in the act via a combined effort of every ISP that is used to facilitate the connection between my system and yours. I would be long gone by the time that happened.

flood6

4:35 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



If you are using it for local testing, I wouldn't worry about having it on a seperate machine.

I haven't seen that error message, but when I set up Apache, mySQL, and PHP on my local box for testing I had to do some work on my firewall to connect to local host. It wouldn't connect otherwise.

I was using Norton Internet Security 2003.

Try disabling your firewall and connecting. If it works you know you'll have to see if you can configure your firewall, if not, you might need to look at how Apache, MySQL, and PHP are configured.

httpwebwitch

4:55 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanx for the security advice...
but actually I only have one machine here, a PC with WinXP, that I'm using for offline development. I just want to have a mini-system setup here to work on my PHP scripts.

(The production/live servers are in Texas, and they are quite secure)

I just re-installed MySQL and have been hesitantly following the steps given at the tutorial (link above). Right now I can access mysql at the command line, and when I invoke my test PHP script, I get a different error:


Warning: mysql_connect(): Access denied for user: 'root@localhost' (Using password: YES) in c:\web\test_mysql.php on line 20
1045: Access denied for user: 'root@localhost' (Using password: YES)

I do suspect this is a Firewall problem. Does anyone know how to config the firewall that comes with WinXP?

inwebsys

5:01 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



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

This is a status message from the MySQL server, so it's not a firewall problem. You are actually connecting to the MySQL server, but you are not authenticating successfully.

Do you have a root MySQL password set?

py9jmas

5:11 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



digitalv - What you say there is applicable to any IP based access controls. There is nothing special about 127.0.0.1. The best approach is to drop all packets entering your network with a from address that shouldn't originate from outside your network at the router. That includes the entire 127.0.0.0/8 class A network.

flood6

5:15 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



You learn a lot about the "nuts and bolts" of Apache, mySQL, and, PHP configuration if you install each of them individually, but if you want something similar that will meet your needs perfectly try a package.

I use PHPDev, you can get it at [firepages.com.au...]

It's free and will save a lot of time and frustration. There is another called "Triad". I have never used that one, but I have read several good reviews for that one, too.

Again, if you are interested in the minutiae involved with the Apache, mySQL, and PHP installation, then you are on the right track. But if all you want to do is run this stuff for testing, you might want to try PHPDev. If nothing else, it will give you more understanding so you can install them individually later if you are still interested in doing so.

httpwebwitch

5:30 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi, I got some advice elsewhere for setting up the WinXP firewall, and I now have access to mySQL with localhost.
Everything seems all right now.
thanks