LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Mysql remote access (https://www.linuxquestions.org/questions/linux-server-73/mysql-remote-access-637008/)

dereko 04-22-2008 07:04 AM

Mysql remote access
 
Right have a problem connecting to my mysql server remotely.

I can do
mysql -h localhost -u jeebers -p
and that works

I can't on the other hand from the local machine do this
mysql -h x.x.x.x -u jeebers -p
where the x.. is the IP address of the machine.

I get an error
ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x'
(110)


Now its a Debain etch machine and i've edited my "my.cnf" file and
commented out bind-address and skip-networking. I've also restarted
mysql.

Anyone any thoughs on why it won't let me connect with the dedicated IP
but it will with localhost?

billymayday 04-22-2008 07:17 AM

Have you checked your firewall settings?

Also, what does netstat -l | grep sql show?

dereko 04-22-2008 07:21 AM

# netstat -l | grep mysql
tcp 0 0 *:mysql *:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 1659061 /var/run/mysqld/mysqld.sock


Yea there might be something in the firewall settings that isn't allowing this but i can't figure out what that would. Its a dedicated server in a hosting company's environment. Any other tests i can do to narrow it down/

billymayday 04-22-2008 07:25 AM

try

telnet se.rv.er.IP 3306

from the remote machine

billymayday 04-22-2008 07:27 AM

Also

iptables -L

dereko 04-22-2008 07:54 AM

Quote:

Originally Posted by billymayday (Post 3129013)
try

telnet se.rv.er.IP 3306

from the remote machine

when i try this it seems to connect and return garbage which i think is what is expected.

dereko 04-22-2008 07:54 AM

Quote:

Originally Posted by billymayday (Post 3129015)
Also

iptables -L

I'm not familiar with this. but
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

that is all that said?

G4george 04-22-2008 11:57 AM

Check the Mysql db to make sure the system in allowed access by IP. The permissions table on MySql is strict on who can access the program.

dereko 04-22-2008 12:12 PM

I solved the problem in the end.

I needed to add -P3306 to my mysql request from the remote machine and it worked. i was defaulting to somethign else for some reason.

I still can't connect from localhost with the IP but i suppose that doesn't really matter.

thanks for the suggestions.

billymayday 04-22-2008 03:55 PM

If it's a public IP that's not surprising

marquardl 04-22-2008 07:46 PM

grant ... to 'user'@'localhost'
 
Maybe the username you use is granted access only on localhost. Most tutorials suggest something like "grant all privileges on db.* to 'user'@'localhost' ...", so maybe you should grant access to that user with something like " ... to 'user'@'x.x.x.x' ...". (x.x.x.x is obviously to be replaced by the IP number).

Don't know if it solves your problem, could be caused by something else as well. Maybe worth trying...

Server issues


All times are GMT -5. The time now is 02:02 AM.