MySQL problem

gumnos (Tim Chase) gumnos at hotmail.com
Tue May 18 21:49:45 UTC 2004


Sorry for the long post.  Without knowing more, there are several things
that could be going batty, so I'll try to address as many as I can think
of.

> problem is that I'm not able to access the server remotely, i.e. I'm
able
> to log in on the same machine but not from outside. Actually, I can't
even
> log in on the same machine using the IP address of it.

My first check would be to see if there's a "skip-networking" item in
your /etc/mysql/my.cnf file.  That would snip any networking access.  I
understand this is the default in a default Debian Woody install.
However, I don't know about a default Gentoo install.

I've got two suspicions--one is that you've got a firewall in place
that's blocking everything that doesn't come from localhost (which might
well include if you name your computer's IP address rather than
127.0.0.1).  The other could be that MySQL is set up to communicate only
via IPC/pipes, and not listen on the network.

If it's the firewall, I'm not sure I'd poke a hole in it to let MySQL
through--rather, I'd use ssh to tunnel the connection over something
that won't send stuff in the open, then open the firewall to the
SSH-redirector.  However, that's just me being paranoid about security
(grins).  I'd test this by just telnetting to your IP address/port and
hit <ENTER> a couple times (both "telnet localhost 3306" and "telnet
`hostname` 3306" to try it via localhost and via whatever your box is
named--might even want to use your direct IP addy too like "telnet
123.45.67.89 80")

As for testing the other condition, you'll find further details in the
manual at MySQL's site:

http://dev.mysql.com/doc/mysql/en/Access_denied.html
http://dev.mysql.com/doc/mysql/en/Can_not_connect_to_server.html

That site also suggests checking for multiple names for your host:
[quoting]
I've received "ERROR 2003: Cannot connect to MySQL server on
'<server_name>' (111)" when the loopback has multiple addresses
configured. One address for 127.0.0.1 and at least one other address. As
soon as the alias for the loopback was removed I was able to connect.
[end quote]

I don't know if that will help you out as well.

Lastly, you may want to check your rights tables--the user you're trying
to connect as may not have rights to do anything when coming from a
"different" host (other than "localhost").  In that case, you should be
able to do an UPDATE statement on the rights table (or toy with a GRANT
statement) to allow the user in question to connect/login from a remote
location.  I'd limit it to a particular IP address or address range,
rather than opening it carte-blanche--and I'd also not grant MySQL
root-account access remotely, as you don't want crackers having a chance
to "ownz yer boxen" (grins)

I hope that something in here helps point you in the right
direction...or at least to diagnose where the problem lies.

-tim








More information about the Blinux-list mailing list