Connecting to mysql db server from a remote server to a local machine

As per my understanding, there are two main things to check before connecting to a remote mysql db server.

1. Bind address.
2. Grant privileges.

I was able to connect to a remote mysql db server from my Mac, it was easy (mysql -uroot -h x.x.x.x -p)

Imagine a scenario for my own learning, I want to connect to a mysql db instance on my Mac from a remote server. Imagine I am logging into this remote linux machine from my Mac and trying to connect to my own Mac db server?

mysql -uroot -h x.x.x.x -p

is raising an error 2003 mysql cannot connect 10060 cannot connect to the x.x.x.x server. It is similar to the reverse proxying while connecting to the local machine from a remote one, can someone direct to right resource (if there is a similar question please comment) which can help me figure out this thing?

Go to Source
Author: JumpMan

Why can’t expose my local port publicly with ssh remote forwording via vps?

I build a simple web on local pc,want to expose my local port with ssh remote forwording via my vps.
Setting in my vps.

vim /etc/ssh/sshd_config
GatewayPorts yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

systemctl restart sshd

Open port 8001 on my vps.

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

Build a ssh remote port forwording on my local pc.

ssh -fNR  0.0.0.0:8001:localhost:80  root@vps_ip

Check port 8001 on my vps.

netstat -plant  | grep  8001
tcp        0      0 127.0.0.1:8001          0.0.0.0:*               LISTEN      797/sshd: root      
tcp6       0      0 ::1:8001                :::*                    LISTEN      797/sshd: root  

It is ready to listen on 8001.
To ping the vps_ip from other pc(not the previous local pc),shows that connection between pc is in good status.
Input http://vps_ip:8001 in other pc.

The connection was reset

The connection to the server was reset while the page was loading.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer’s network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

Why can’t expose my local port publicly with ssh remote forwording via vps?

Go to Source
Author: it_is_a_literature