MYSQL Web Development

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.
ButmachineC does not allow your machine. 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 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!!
eg:

mysql -u  -p -h localhost -P <machineA-port>

or

mysql -u  -p -h 127.0.0.1 -P <machineA-port>


Smartherd

Team Smartherd has a decade of experience in online teaching. Our instructors are tech geeks and holds significant experience in their respective domains.