Sunday, February 28, 2010

Setting up a portable MySQL with VS 2008

Okay so I tried out firebird. It was good but SQL Lite was just plain TOO well integraded so didn't make me want to move (e.g. integrated table designer). Also, the ADO.NET entity framework provider for firebird made only NOT NULL entries (i.e entries that were not primary and marked as NOT NULL) come out as Primary (DDEX version 2.0.4). This was going to be too much hassle everytime I update model from database.

Now trying out MySQL. Results later.

As mentioned before I basically want a HIGH performance yet portable database.

PORTABLE MYSQL
For a portable MySQL i downloaded the noinstall zip file from mysql downloads for windows and just extracted it to a folder.   
PS: I only downloaded the 32 bit version and ran it on 64 bit. It runs fine. I did this because of easier distribution and lesser user headache.


VS INTEGRATION
Just downloaded the zip mysql-connector-net-6.2.2.zip from my sql site and installed the MSI therein. Awesome!

Managing MySQL
As a service

Just install MySQL as a service by running
mysqld --install 
And start the service using:  net start mysql
Stop the service using:
net stop mysql
and Uninstall the service:
mysqld --remove

As a standalone server
Tracking down failure in a service can be tricky. You can start the standalone version using :
mysqld --standalone
If it is running this way you can shut it down using the following:
msyqladmin -u root shutdown

I went with the standalone server since it need to run it embedded :)

Setting up VS 2008 Connection Dialog
  • Just select MySQL Database as you datasource.
  • server:localhost
  • username:root
Test connection and you are good to go :) enjoy!