How to Access phpMyAdmin on Google Cloud Compute on your Mac

I’ve been doing a small bit of Google Cloud Compute(GCP) configurations to run this blog. I thought I’ll start sharing some of the steps I’ve gone through which could be useful to others out there. So I’ve setup a GCP instance and configured it with a WordPress Bitnami stack. I’ve got some videos of those in this playlist if you want to follow along.

But on this post I would be discussing about accessing phpMyAdmin on GCP via an SSH Tunnel on your Mac.

In order to access phpMyadmin on a WordPress Bitnami stack from Google Cloud Compute you need to do this using an SSH tunnel. On the WordPress Bitnami stack, phpMyAdmin is blocked from the public and only accessible from the localhost. This is where SSH tunnel comes in. Basically you access the localhost on a particular port on your computer that forwards that information to the remote server on an encrypted channel and then the remote server sends the content back to the local computer.

Here is an illustration on how that access is provided via the SSH tunnel.

Another example of using SSH tunnel is when a website is blocked from your company firewall or proxy filter, you can use SSH tunnel to bypass the proxy and connect to a remote computer that has no restriction and can access the blocked website.

With that said, lets connect via SSH tunnel on your Mac.

  1. Open the terminal and change directory to where your private key is located
  2. Type in following, replace the private key name, user and IP to match yours. Enter passphrase when prompted.
    • ssh -N -L 8888:127.0.0.1:80 -i <keyfile> <username>@<ip>
  3. If successful it would not prompt any errors. If you want to login to the instance you can strip out the -N parameter.
    • ssh  -L 8888:127.0.0.1:80 -i <keyfile> <username>@<ip>
  4. Open your brower and enter 127.0.0.1:8888/phpMyAdmin
  5. You should be able to view phpMyAdmin

 

Here is a video I made for the process.

 

That should be it. If you have questions or comments please use the section below and feel free to subscribe to my youtube channel.

No Renaming Tables feature in phpMyAdmin

Quick tip. The feature is not (yet) supported in phpMyAdmin but you can easily make the change by simply issuing this sql statement.

RENAME TABLE old_table TO new_table

Update On phpMyAdmin select a table then go to Operations, Under Table Options you would see Rename Table to feature.

All in One Package

I didn’t like using All in One Package during the my early years of learning how to install Apache, PHP and MySQL in my Windows box – there were programs like PHPTriad and similar which offers these three in one convenient installation without getting your hands dirty so to speak on the configuration. From my experience you should start with the manual installation to know the ins and out. That was what I was doing for the years, when a new version comes out I apply the upgrade to my system.

Earlier this month I got this client who uses WAMP 2.0 setup for the system we were developing.  Somehow I wasted several hours trying to make it run on my system. Was getting close but somehow if some changes were done to the system codes I feel it would break again. So I decided to try using WAMP 2.0 and it turns out its not that bad afterall. It has a UI for disabling/enabling extensions and modules, you can still go into the php.ini, my.ini, httpd.conf if you decide to edit manually from a shortcut all in one convenient place in your systray.

image_menu_wamp

It made my work faster, overall if you are using the manual way and move to an all in one package like WAMP 2.0 you would benefit both time and organization. I’m now a believer.