Question

How can I connect to databse for access remote?

  • Posted October 21, 2013

Hi guys!

I try to connect to my DB from navicat but is not possible. I installed LAMP as indicated in this guide ( https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-6 ), but they refused me via remote access and do not know how to configure it to give permissions.

how to allow remote access to mysql?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey CFRANCO80, did you find the way to connect remotely to your MySQL server using NaviCat? or somebody knows if this is possible?

restart mysql on ubuntu: sudo service mysql restart

Where did you get that command from? <br> <br>Did you add a user for connecting remotely? See <a href=“https://www.digitalocean.com/community/articles/how-to-create-a-new-user-and-grant-permissions-in-mysql”>https://www.digitalocean.com/community/articles/how-to-create-a-new-user-and-grant-permissions-in-mysql</a> <br> <br>Replace <code>localhost</code> with <code>1.2.3.4</code> where <code>1.2.3.4</code> is your home IP address.

Hi Pablo, <br> <br>I tried entering the following command but it gives me error <br> <br># mysql -u root -p <br> <br>mysql> update db set Host=’111.11.11.1‘ where db=’db_name‘; <br>ERROR 1046 (3D000): No database selected <br> <br>think you are missing a step? <br> <br> <br>

Did you grant your MySQL user privileges to access the database on the public IP?

Hello Pablo, <br> <br>Thank you very much for the help. <br> <br>Restart MySQL? <br>Yes, yes I did. <br> <br>How many remote hosts need to connect to MySQL? <br>I need to connect remotely from 2 teams mac os , one at home and one in my work. <br> <br>the remote hosts are trying to connect to MySQL Also behind a firewall? <br>No, because I could connect to other servers without problem. <br> <br>any other idea? <br> <br>Best regards

Firewall looks okay. After you changed the <code>bind-address</code>, did you restart MySQL? <br> <br>Also, instead of opening up the MySQL port to the entire world, are you able to limit it to a few IPs? The question is, how many remote hosts need to connect to MySQL? If (i) a few and (ii) they have static IPs, then you’re best advised to limit MySQL access to those IPs, only. <br> <br>Lastly, are the remote hosts trying to connect to MySQL also behind a firewall?

Hi Pablo! <br> <br>This is my firewall <br> <br># iptables -L -n <br>Chain INPUT (policy DROP) <br>target prot opt source destination
<br>ACCEPT all – 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED <br>DROP tcp – 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00 <br>DROP tcp – 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 state NEW <br>DROP tcp – 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F <br>ACCEPT all – 0.0.0.0/0 0.0.0.0/0
<br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:26 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:465 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:110 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:995 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 <br>ACCEPT tcp – my.ip.work.station 0.0.0.0/0 tcp dpt:22 <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306 <br> <br>Chain FORWARD (policy ACCEPT) <br>target prot opt source destination
<br> <br>Chain OUTPUT (policy ACCEPT) <br>target prot opt source destination
<br> <br>see something strange?

Check out <a href=“https://www.digitalocean.com/community/articles/how-to-setup-a-basic-ip-tables-configuration-on-centos-6”>How To Setup a Basic IP Tables Configuration on Centos 6</a>

Hi Pablo, <br>as I can see this?