Mysql Remote Access

Issues related to applications and software problems
Post Reply
ufkayolcu
Posts: 3
Joined: 2014/05/15 08:40:38

Mysql Remote Access

Post by ufkayolcu » 2014/05/15 09:02:10

I try to configure Mysql to connect remotely.

Content of my /etc/my.cnf file.

Code: Select all

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
port =3306
bind-address =*
#skip-networking
skip-name-resolve
max-connection=512
I open port for mysql.

Code: Select all

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
and saved with "service iptable save" command.

I added mysql user for remote access like that.

Code: Select all

mysql> GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'PASSWORD';
And I restarted mysql with this command.

Code: Select all

service mysqld restart
When I try to connect from my client computer with this command

Code: Select all

$ mysql -u root –h myipadress –p
I get message
ERROR 2003 (HY000): Can't connect to MySQL server on 'myipadress' (113)

Please help me.

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Mysql Remote Access

Post by TrevorH » 2014/05/15 11:08:28

Do you really want to open iptables on the eth0 interface to everyone on port 3306?

Run netstat -antp | grep 3306 and make sure that mysqld is listening on the interface you think it is.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

ufkayolcu
Posts: 3
Joined: 2014/05/15 08:40:38

Re: Mysql Remote Access

Post by ufkayolcu » 2014/05/15 13:12:35

Later, I will change some settings for security. I want to find the problem.
I got this response.

Code: Select all

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      8712/mysqld 
Thank you for your response.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Mysql Remote Access

Post by gerald_clark » 2014/05/15 13:24:41

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
will add the rule after the reject.
Either use an -I or run system-config-firewall.

ufkayolcu
Posts: 3
Joined: 2014/05/15 08:40:38

Re: Mysql Remote Access

Post by ufkayolcu » 2014/05/15 14:39:20

Thanks. It solved the problem.

Post Reply