Keep vagrant database data after vagrant destroy

ubuntu, vagrant, virtual-machine

Solution

It depends on the RDBMS you use.

For MySQL on Ubuntu, you can simply backup (`tar` or `rsync` to a remote host) the /var/lib/mysql folder (when mysql is NOT running) and its configuration files `/etc/mysql`.

For PostgreSQL it is similar, the database files are normally under cd `/usr/local/pgsql/data`. Refer to File System level backup

NOTE: avoid using the default `vboxsf` to share large number of files between guest and host because it has known performance issues.

Problem

What is the best/acceptable practice for keeping database data after a Vagrant destroy? Should I create a shared folder for my database data? If so where (by default) does ubuntu store such data? I forgot to mention my host and guest OS' are Ubuntu and am referring to MySql

Original source