Secure Remote Administration of MySQL Database Server
I wanted an alternative to having phpMyAdmin installed on my server as I couldn't help but be a little concerned about having a web application that has access to all my databases. The alternative?
I present here for your reading pleasure 2 alternatives, based around 1 simple principle:- ssh tunneling.
- Set up an SSH tunnel in terminal:
ssh -L 3396:127.0.0.1:3306 username@WebServerIP
or use 'SSH Tunnel Manager‘ or ’Almost VPN' or the like.
I‘m using port 3396 on the local machine just ’cause it's easy to remember.
- Now set up either phpMyAdmin running on your local version of apache (Personal Web Sharing under Sharing Prefs Pane) with php (get Marc Liyanage's PHP Apache Module if you don't already have php installed), making sure that you put 127.0.0.1 as the MySQL host, and 3396 as the MySQL port in the config.inc.php file.
Alternatively, despite being a long term phpMyAdmin user, I have switched to the combination of the MySQL Administrator application and CocoaMySQL-SBG for full GUI database administration loveliness. Again, with both apps, use 127.0.0.1 as the host, and 3396 as the port.
NB: because the tunnel is essentially making the database access happen on the server itself, the user details you use can be limited to access by localhost only.
Easy. All you have to remember is to start the tunnel before you use the administration tools.
All Clear? SteamSHIFT out.
Technorati Tags:
mac, osx, server, developing, php, mysql, database, ssh, phpMyAdmin