LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Can't connect to (non localhost) mysql server from laptop or desktop. (https://www.linuxquestions.org/questions/linux-server-73/can%27t-connect-to-non-localhost-mysql-server-from-laptop-or-desktop-614874/)

DiBosco 01-19-2008 08:05 PM

Can't connect to (non localhost) mysql server from laptop or desktop.
 
I have set-up mysql on my home server machine which has a static ip address of 192.168.0.1. This is a command-line only version of Mandriva.

I then set-up the root sql password and created a database.

I have been running a program called Knoda on a couple of machines and that works just fine connecting to localhost as root, but I just cannot get it to connect to the mysql server running on my 192.168.0.1 home server.

I should say here that I am no expert on sql of any flavour and and learning as I go along. I have got databases up and running on a couple of machines running Knoda, but always connected to the mysql engine running on
that local machine.

Is it most likely to be a firewall issue? (Although I have tried switching it off to no avail.) Do I need to open up the relevant IP port for incoming traffic or should mysql have done that? Could it be a separate issue altogether?

Any ideas would be gratefully received!

ilikejam 01-19-2008 09:43 PM

Hi.

It's probably the user authentication. Have a look at:
http://dev.mysql.com/doc/refman/5.0/...ing-users.html

Dave

DiBosco 01-20-2008 09:00 AM

Thanks for the suggestion, Dave. I can log in on the server itself as the user, but not from a remote machine, which makes me think it's something to do with the networking set-up rather than permissions.

ilikejam 01-20-2008 09:55 AM

Can you telnet to port 3306 on the DB host from the remote side?

Dave

DiBosco 01-20-2008 10:27 AM

When I try I get this:

[robertw@Desktop ~]$ telnet 192.168.0.1 3306
Trying 192.168.0.1...
telnet: connect to address 192.168.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused

I can ping and connect to all my smbmounts on 192.168.0.1. I believe 3306 is the TCP port that mysql uses by default and I haven't altered that.

ilikejam 01-20-2008 11:16 AM

Looks like it is a network/firewall issue then.

Try running:
# iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

on the DB host to punch a hole in the iptables firewall (assuming iptables is running). If there's still no joy, post the output from:
# netstat -pantu | grep LISTEN

Dave

DiBosco 01-20-2008 12:19 PM

Ah, might have made some progress with the netstat:


[root@server robertw]# netstat -pantu | grep LISTEN
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:2273 0.0.0.0:* LISTEN 4028/mysqlmanager
tcp 0 0 0.0.0.0:41028 0.0.0.0:* LISTEN 3773/rpc.statd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 4023/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3692/portmap
tcp 0 0 0.0.0.0:58709 0.0.0.0:* LISTEN 4133/rpc.mountd
tcp 0 0 0.0.0.0:42037 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 5230/0
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 4023/smbd
tcp 0 0 :::22 :::* LISTEN 4017/sshd
tcp 0 0 ::1:6010 :::* LISTEN 5230/0

So, looks like it's actually listening on 2273? Or is that a different package which is purely for management? If I change the frontend package (Knoda) to use port 2273 on 192.168.0.1 then I get bad username/password pairing error. Which suggests it's not what I should be logging on to as those credentials work if I ssh in to the machine and log on directly.

DiBosco 01-20-2008 12:29 PM

Delighted to say, I've sussed it. It was actually a line in /etc/my.cnf that simply says:

skip-networking

if you comment that out with a # symbol it works.

Many thanks for your help, really appreciate it. :)

ilikejam 01-20-2008 12:29 PM

Ah. mysqld isn't listening...

Edit: Never mind, I see you've got it. Cool cool.

Dave

DiBosco 01-20-2008 12:32 PM

Heh, looks like I must have picked up your thoughts down the M6 as you suddenly realised it! ;-)


All times are GMT -5. The time now is 05:47 PM.