Page 1 of 1
MySQL Remote Access Problem
Posted: 2018/03/29 18:58:07
by MacArthur
Hi, newbie here, just start learning Linux. Got this old PC, installed CentOS 6.9 (too old for CentOS 7) and MariaDB 10.2.14 using instructions here (
https://www.if-not-true-then-false.com/ ... ntos-rhel/). I've added the INPUT rule into IPTABLES as instructed, were able to login to the MariaDB, create database/user, everything is fine
However, when I tried to access this MariaDB (192.168.1.11) from another Windows 7 PC (192.168.1.4), it just won't connect. They can ping each other, but telnet will fail
Code: Select all
C:\windows\system32>telnet 192.168.1.11 3306
Connecting To 192.168.1.11...Could not open connection to the host, on port 3306: Connect failed
I installed WorkBench on Windows 7 PC but got this error when trying to connect
Any help/suggestion/advice is appreciated!
Re: MySQL Remote Access Problem
Posted: 2018/03/30 02:32:06
by Whoever
I think that the default installation of MySQL disables remote access to the database. I would assume that MariaDB is the same.
Look in the file /etc/my.cnf. You will probably find the following:
If so, remove the "skip-networking" and restart MariaDB.
Re: MySQL Remote Access Problem
Posted: 2018/04/02 16:07:25
by MacArthur
Thanks. But it's not there. Don't see anything inside the .cnf
Code: Select all
[root@EUP01 etc]# pwd
/etc
[root@EUP01 etc]# more my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[root@EUP01 etc]#
[root@EUP01 etc]# cd my.cnf.d/
[root@EUP01 my.cnf.d]# ls -ltr
total 12
-rw-r--r--. 1 root root 232 Mar 26 12:41 mysql-clients.cnf
-rw-r--r--. 1 root root 763 Mar 26 12:41 enable_encryption.preset
-rw-r--r--. 1 root root 1091 Mar 29 12:35 server.cnf
[root@EUP01 my.cnf.d]# grep 'skip-networking' *.cnf
[root@EUP01 my.cnf.d]#
Any other ideas?
Re: MySQL Remote Access Problem
Posted: 2018/04/02 16:19:36
by TrevorH
I've added the INPUT rule into IPTABLES as instructed, were able to login to the MariaDB, create database/user, everything is fine
Are you using iptables.service or firewalld? If you use firewalld then do not use iptables to manipulate rules behind its back as it doesn't like it and removes/reverts any rule changes you make. Use firewall-cmd to manipulate firewalld rules. If using iptables.service then did you insert a new rule or append a new one to the end of the chain? If you appended then it's probably gone after the global REJECT line that disallows all not-explicitly-allowed connections.
Re: MySQL Remote Access Problem
Posted: 2018/04/02 16:42:12
by MacArthur
I'm using iptables. This is what I have:
Code: Select all
[root@EUP01 my.cnf.d]# nano -w /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-I INPUT -p tcp --dport 80 -j ACCEPT
COMMIT
[root@EUP01 my.cnf.d]#
[root@EUP01 my.cnf.d]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@EUP01 my.cnf.d]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@EUP01 my.cnf.d]#
Don't know what I've been messing around, not sure how that "Chain FORWARD"/"Chain OUTPUT" thing get in there...