Setting up MySQL and using MySQL Workbench (via SSH Tunnel) on Amazon EC2

Here are the instructions on how to get MySQL Workbench up and running on Amazon EC2 after creating a "Getting Started on Fedora Core 8" AMI instance.

1. ssh into your instance forwarding port 3306
ssh -i ~/ec2key.pem root@your-ec2-ip-or-hostname
I normally put localhost instead of 127.0.0.1, but OSX gives me grief by
2. Install MySQL
yum install mysql-server
3. Configure MySQL to start on startup
ntsysv
check "mysqld"
4. Start up MySQL
/etc/init.d/mysqld start
5. Set root password
mysqladmin -u root password new-password-here

Now, Launch MySQL Workbench
Under SQL Development

Click New Connection
For Connection Method

Standard TCP/IP over SSH

SSH Hostname
184.72.54.176

SSH Username
root

SSH Key File
.pem file

Mysql Hostanem
127.0.0.1

MySQL Server Port
3306

Username
root

Password:
Set to previous password

Now On the right
New Server Instance

Choose Take Parameters from Existing Database Connection
Continue
Continue

Under Set remote configuration parameters
Username:
root
Check Authenticate Using SSH Key
and select your pem file

Continue
Continue

Continue
Continue

Enter a good instance name and click

Finish

Bonus - Accessing MySQL directly
If you want to access your MySQL server directly, you can do so through a standard ssh tunnel:

ssh -i ~/ec2key.pem -L 3306:127.0.0.1:3306 root@your-ec2-ip-or-hostname

In a new terminal window, you can then run
telnet 127.0.0.1:3306 and verify you can access mysql directly.