Reputation: 9721
With regard to the physical media used to store MySQL databases (i.e. flash card, or USB) on a RasPi, is there a documented preference / best practice?
I've searched and searched but cannot find anything documented; hopefully I've just overlooked it.
Upvotes: 0
Views: 826
Reputation: 48865
Typically data is the most important asset your application handles. There are a number of applications that have long been obsolete, but the database they used to handle still holds high value. Is sum, you don't want to lose your data. At all. Unless, of course this is a proof of concept or testing application.
I would strongly advise against an SD Card to store important data, since a database is typically written very often and will use all the write cycles the card has pretty fast; this will force the card to go into read-only mode after a short period of time.
A USB pendrive is not better than the SD card (maybe a bit). Still they are note very reliable if you are constantly writing to it, as a database application will do.
Any medium to serious application should use a real hard drive. For my local wiki at home (that incidentally uses MySQL) I use an SSD drive that can handle high level of writes operations without issues. And I ended up spending $100 on the SSD since I wanted a high quality one. Nevertheless it's a good idea to backup your database once a day automatically to another machine (another $5 Pi with an SD card in my case). Though less likely, the primary SSD drive can fail too.
Upvotes: 2