Access WordPress Database via SSH Tunnel on Mac

Jan 7, 2019

To access the MySQL database behind a WordPress site that is hosted on the cloud from a remote Mac, it’s relatively simple: establish a SSH tunnel and then use any browser to visit the phpMyAdmin.

First, establish the SSH tunnel to the host machine:

ssh -N -L SOURCE-PORT:127.0.0.1:DESTINATION-PORT -i KEYFILE USERNAME@SERVER-IP

Because by default phpMyAdmin is running on port 8888, the above commband becomes:

ssh -N -L 8888:127.0.0.1:80 -i KEYFILE USERNAME@SERVER-IP

Second, open browser and visit 127.0.0.1:8888/phpmyadmin. All done.

demo

comments powered by Disqus