Connect to Remote MySQL Server using Proxy
Let's say your local is machineA.
The server to which you have access is machineB.
The remote MYSQL server is machineC.
Now, machineB has access to machineC, the ip for machineB is allowed. But you want to access machineC from your machine, i.e. machineA.
But your machine is not allowed by machineC. How would you generate a connection between machineA and machineC? Somehow using machineB, right?
To do that, forward your local machineA port to port of machineC, by connecting to machineB. So that when you are connected to machineB, and then you try to create connection from machineA to machineC, it sends the request through machineC.
You will have to do something like this:
ssh -i <your-private-key> -L <machineA-port>:<machineC-ip or machineC-hostname>:<machineC-port> <machineB-username>@<machineB-ip or machineB-hostname>
Assuming you can ssh to machineB, and that your public key is set up there.
You can then access machineC from machineA using
localhost: or 127.0.0.1:
Type in the following in machineA and get connected to the remote server!!
mysql -u -p -h localhost -P <machineA-port>
mysql -u -p -h 127.0.0.1 -P <machineA-port>