Latest Replies
Monday
May312010

Setup Inexpensive mySQL in the Cloud for Testing

Today I needed an instance of mySQL database available in the Internet for testing.

Given my Win 7 development machine, the primary choice would've been to start Windows Virtual PC, install mySQL for there, expose the machine to the outside WWW.

Installing mySQL (or any other test component) directly on the primary work OS is not the recommended option, since if something goes wrong with install/uninstall - too much time will be wasted. Even if there is a backup disk image somewhere around.

However, getting Windows Virtual Machines running on Win 7 is already too much friction. First you need to get validation component, run it; try again with IE instead of Google Chrome; then install a few more downloads, while fighting with Internet Explorer, as it tries to protect you from yourself.

I gave up quickly and switched to a different setup - using cloud linux VM. This short article is a reminder note for myself later.

Here's the routine of setting up mySQL db instance for testing purposes.

First, provision latest Ubuntu VM with the smallest size, somewhere in the cloud. For example, you could use Rackspace Cloud Servers, which will start your VM in a few minutes. Amazon EC2 would work for a fast setup as well.

Log in via Putty (just use the IP addres from the email, while accepting certificate and typing the provided root credentials) and:

sudo apt-get install mysql-server

Make sure to set the root password. Afterwards launch mysql:

mysql -u root -p

Create database in mysql prompt:

CREATE DATABASE database1;

Create user with all permissions (we are testing, remember):

GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'%' 
IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

Exit mysql afterwards.

Configure the server to accept incoming connections by starting nano:

nano /etc/mysql/my.cnf

and commenting out the line

bind-address           = localhost

using '#' sign for comments, then 'WriteOut' and 'Exit'. Afterwards, restart mySQL:

restart mysql

Alternative command to restart:

/etc/init.d/mysql restart

Voila. Interesting enough, the whole process is faster and more deterministic, than click-click in Win 7. Obviously, you could save this server into the cloud files and spawn fresh VM instances from the image later, instead of copying and pasting scripts. This is similar to VHD and VM juggling when you have Microsoft Hyper-V server running around.

NB: it's funny, that I've been writing these lines while waiting for Windows Azure to deploy another release in the cloud. Deployment processes could've been a bit faster here. Since Windows Azure is a young platform, things will hopefully improve with the pass of time.

« Time Machines Should Support LINQ | Main | Salescast - Scalable Business Intelligence on Windows Azure »

Reader Comments (5)

Hi Rinat

If you haven't tried VMware Workstation you should give it a go. I like to rely as much as possible on my local machine and I find this a real joy to use.

Cheers

Sean

June 1, 2010 | Unregistered CommenterSean Kearon

Sean,

I've used VMware before. The trick was that I've been testing some aspects of a Windows Azure service running in the Azure Fabric (not local machine). So mySQL instance should've been accessible in Internet.

Exposing VMWare VM through the local network to the outside, never was one of my favorite things to do))

Rinat

June 1, 2010 | Registered CommenterRinat Abdullin

FathomDB does just this. I'm currently giving them a go and so far, so good.

June 1, 2010 | Unregistered CommenterBoris Scheiman

Boris,

Yes. It looks like the are actually running on top of Rackspace (with Amazon as possible option outlined on the homepage)

June 1, 2010 | Registered CommenterRinat Abdullin

I like to use the ready-to-go .iso and vmware images of http://www.turnkeylinux.org/

They provide images for MySQL, Wordpress, LAMP etc etc

June 1, 2010 | Unregistered CommenterFrank
Comments for this entry have been disabled. Additional comments may not be added to this entry at this time.