If you are looking to enable ssh VPN tunnel to access phpmyadmin on google cloud, here is a possible solution
This hint is especially good if you are trying to connect to your MySQL database server using phpMyAdmin.
It is assumed that you have already setup your Google Cloud server, installed Apache, MySQL and phpMyAdmin.
Opening up phpMyAdmin for access from any machine (global access) is not a safe thing to do. It is insecure and not advised. Of course, you may add your IP address to the phpMyAdmin.conf file. But again, adding your IP to the phpMyAdmin.conf everytime is not advisable either.
Result when accessing phpmyadmin before creating SSH tunnel |
The best thing to do is to create a VPN tunnel connection to your server, using the following instructions.
When you access phpmyadmin before creating the tunnel, shows you an error message similar to the one on the left.
So, we open the Cloud SDK Shell.
Then we create the VPN tunnel using the following command.
gcloud compute ssh <NAME-OF-INSTANCE-FOR-THE-TUNNEL>
eg., gcloud compute ssh myCentos-1
--zone us-central1-b --ssh-flag="-L" --ssh-flag="8888:localhost:80"
Note: You will be replacing the words in bold above with your relevant server name and zone name.
phpMyAdmin Login Screen shows after successful creation of ssh tunnel |
After doing the above, open phpMyAdmin from your browser by typing the address
http://localhost:8888/phpmyadmin/
Voila, you get the login screen!
No comments:
Post a Comment