LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-18-2013, 04:02 PM   #1
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
Giving computers on network access to MySQL


I want to give MySql access to a Raspberry Pi on my local network.

Let's say the Raspberry Pi is at 192.168.1.10 and the server pc is at 192.168.1.100 (Fedora 16)

My my.cnf at 192.168.0.100 file is as follows

[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld]
bind-address = 192.168.0.100
bind-address = 127.0.0.1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

I have also gone into the firewall and opened port 3306 and opened it on the router.

I have issued a grant similar to:
grant select, insert, delete on mydb.* to pi@192.168.0.10;

When I try to connect, I get this:

mysql --host=192.168.0.100 --user=pi@192.168.0.10
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.100' (111)


I have installed MySQL Client on the Pi (5.5.28)
Fedora Box mysql-5.5.23-1.fc16.x86_64
What am I forgetting to do or doing wrong?
 
Old 02-18-2013, 04:59 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
You need to setup your port forwarding on your router more than likely. Can you confirm that the system is listening on :3306? If taht is the case then setup the forwarding on your router so the requests get there.
 
Old 02-23-2013, 08:51 AM   #3
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
Netstat says I have a server listening on that port for 127.0.0.1 and I can do the following:
mysql -u user -P 3306 -p
And it connects to my server, so I am assuming that it does use port 3306

I have a netgear router. On my Block Services Page I have the following:

Block Services

Services Blocking
Never
Per Schedule
Always

Service Table
# Service Type Port IP
1 MySQL 3306 all

I also have on the Port Forwarding Page:
# Service Name Start Port End Port Server IP Address
1 MySQL 3306 3306 192.168.0.100

And still no mysql service from 192.168.0.100 is available
 
Old 02-23-2013, 10:24 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,698

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
You only have to configure port forwarding on the router if trying to access a service from outside your LAN.

Did you restart mysql so the changes will take effect? If netstat only indicates mysql is listening on 127.0.0.1 then that is the reason for the error.
 
Old 02-23-2013, 06:56 PM   #5
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Original Poster
Rep: Reputation: 43
I am not sure how to read this, but:
I have restarted mysql several times.

Netstat MySQL Line says:

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

IPTables is set up as

[root@draco ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT udp -- anywhere anywhere udp spt:svrloc
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:domain
ACCEPT udp -- anywhere anywhere state NEW udp dpt:domain
ACCEPT udp -- anywhere anywhere state NEW udp dpt:ipp
ACCEPT tcp -- anywhere anywhere [root@draco ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT udp -- anywhere anywhere udp spt:svrloc
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:domain
ACCEPT udp -- anywhere anywhere state NEW udp dpt:domain
ACCEPT udp -- anywhere anywhere state NEW udp dpt:ipp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ipp
ACCEPT udp -- anywhere anywhere state NEW udp dpt:ipp
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:16514
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT udp -- anywhere 224.0.0.251 state NEW udp dpt:mdns
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql
ACCEPT udp -- anywhere anywhere state NEW udp dpt:mysql
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:xmpp-client
ACCEPT udp -- anywhere anywhere state NEW udp dptark-agent
ACCEPT tcp -- anywhere anywhere state NEW tcp dptostgres
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere draco.oldboy.com state NEW tcp dpt:mysql
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination state NEW tcp dpt:ipp
ACCEPT udp -- anywhere anywhere state NEW udp dpt:ipp
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:16514
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT udp -- anywhere 224.0.0.251 state NEW udp dpt:mdns
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql
ACCEPT udp -- anywhere anywhere state NEW udp dpt:mysql
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:xmpp-client
ACCEPT udp -- anywhere anywhere state NEW udp dptark-agent
ACCEPT tcp -- anywhere anywhere state NEW tcp dptostgres
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere draco.oldboy.com state NEW tcp dpt:mysql
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
 
Old 02-24-2013, 07:23 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
MySQL appears to be only listening to 127.0.0.1.

Try removing the "bind-address = 127.0.0.1".

If that works remotely, but not locally try "bind-address = 0.0.0.0", or remove the bind-address entirely.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Building a linux router - cannot access computers on other side of the network pjeeanah Linux - Networking 2 05-20-2009 11:47 AM
How can I access printers and other computers on a windows network with Linux? Iltbreg Linux - Networking 4 01-23-2008 09:23 AM
No internet access while other computers in the network are turned on. Slackware 11.0 RicardoB Linux - Networking 10 04-03-2007 11:48 AM
how do i access other computers on network? Slothburger Linux - Networking 2 07-30-2006 04:10 AM
Debian Woody: Can't access internet through router, but can access network computers marales314 Linux - Networking 3 06-09-2006 12:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration