How to enable remote connection to MySQL server

Status
Not open for further replies.

jasoothai

Active Member
171
2011
10
0
How to enable remote connection to MySQL server ?

I followed this :
1. Edit /etc/sysconfig/iptables file:

nano -w /etc/sysconfig/iptables
2. Add following line before COMMIT:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
3. Restart Iptables Firewall:
service iptables restart
4. Test remote connection:
mysql -h dbserver_name_or_ip_address -u webdb_user -p webdb
But when executing first command I got like this :

ïkdkkd¿½ddkd½kdïkdkkd¿kkdkd½kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�kd�k$






















^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell
Where is the commit line ? :(


Noobish question.
What is the use of enabling remote connection to MySQL server ?
I had set "Disallow root login remotely? [Y/n] Y" in MySQL Secure Installation.
What to do now. Please help.
 
Last edited:
3 comments
Hi,

This is because that character set issue.

You don't need to open MySQL remote connection, its just the purpose of to allow Your MySQL server to connect with any remote connection e.g for example I can use your MySQL database on to any website on different server or to connect with it.

due to security reasons most of companies use localhost as MySQL preferred host address.
 
Just if others end up on this thread looking to activate remote mysql connections, here is what you have to do:

There is no need to edit the /etc/sysconfig/iptables file, you can directly execute the iptables command on the server and save iptables to make the rule permanent.

iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
service iptables save
If you have other firewalls like APF or CSF, you have to edit its configuration file to allow incoming connections on Mysql port.

Once done, you have to grant necessary privileges to the database user and the remote IP on the Mysql user using the Grant command. The following tutorial will guide you on how enable remote access to the mysql server/database.
 
Status
Not open for further replies.
Back
Top