4

I recently installed a portable WAMP server on my usb stick. Really nice, I can do some php programming on my girlfriend's windows7 laptop without installing anything on it.

I also have a LAMP environnement on my linux computer.

When I plug my usb stick on my linux box, I can easily mount -o bind /usbstick/wwwfolder ~/public_html and work on my php script from there.

But my question is, is there a way I could get the database from my usb stick's MySql server, to run on my linux MySql server? So I can modify data base schema from my Linux workstation, doing some INSERTS in some tables, and then plub my usb stick on the laptop and get my up-to-date database running from the portable environnement?

I don't know where / how MySql stores its databases.

EDIT: Basically, I want to "mount" the database from the usb stick in my Linux' installed MySql server, without extracting and importing the data, so there is just ONE database used for BOTH environnement. Hope this helps clarify the question.

Johnny5
  • 153

3 Answers3

5

When you start the MySQL Server, you can specify --datadir, so you could probably script something to get MySQL to use the data on the USB stick.

Jaydee
  • 176
2

If you're doing some kind of light development in this way, I'd recommend you use sqlite rather than mysql. YOu can simply copy the file around and not worry about the database. IF you have a database abstraction layer, this can be done quite easily.

0

Using a USB Flash Stick for a MySQL database is a really bad idea. You are guaranteed to lose that data. A USB Flash stick only has so many reads/writes. Read up on Flash Drive Wear Leveling.