Skip navigation links

MySQL Forums :: MySQL & Embedded Databases :: A MySQL Database On A Flash Card


Advanced Search

A MySQL Database On A Flash Card
Posted by: Edwin DeSouza ()
Date: August 15, 2006 06:24PM

A Mysql Database On A Flash Card
by Peter Laursen

Byt accident I came across a trick how to make a MySQL database 'portable' - that is having it on a network share or on a USB/Firewire-attached storage system or even a Flash Card or a pen drive.

It seems that MySQL is very strict about that the /datadir must be a local folder on a fixed drive. Changing the /datadir in the config file to a network share or a USB or Firewire device does not seem to work. At least I never managed to have MySQL start with it. That is probably by design!

However this trick works (at least on Windows): Use some 'virtual encrypted disk software'. Create an appropriate file on some attached drive, map this file to a 'virtual encrypted drive' with the 'virtual encrypted disk software' and the 'virtual drive' will show up in Windows Explorer. And the windows 'mounting mechanism' does not mark it as something special. It is just like a local drive. I can now copy my existing MySQL /datadir there, change the /datadir setting in my.ini and restart the server. It works perfectly - MySQL now uses the /datadir on the 'virtual disk'. It works with Windows shares, Samba shares on Linux, USB- and Firewire attached devices.

I did NOT perform any benchmarks tests with this! But with a not-too-demanding encryption algorithm I do not think performance is especially low. And the fastest USB-2 CF cards are now practically as fast as a (P)ATA 100 drive. The 'bottleneck' is the PCI-bus. You really feel when a USB2 device uses the PCI-bus extensively! But that may depend on the USB implementation in the chipset as well.

Now a 4 GB and maybe even soon a 16 GB CF card isn't that expensive any more. So you can bring your MySQL database with you in your pocket. And safely encrypted too.

I did this with the Paragon Encrypted Disk version 2 (an 4-5 years old version), but after revealing this trick to some other people I have reports that it works just as well with similar software - 'buyware' and 'freeware'.


http://www.webyog.com/forums//index.php?automodule=blog&blogid=3&showentry=66



Edited 1 time(s). Last edit at 05/18/2007 05:07PM by Edwin DeSouza.

Options: ReplyQuote


Subject Written By Posted
A MySQL Database On A Flash Card Edwin DeSouza 08/15/2006 06:24PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.