title: Pre-existing MySQL data with Vagrant / VirtualBox
body: <p><strong>Background:</strong> I used to develop using MAMP and over the months/years I've accumulated a large mysql database (a few gigs) that I use for development for my different projects. I finally got around to setting up a VM using Vagrant and I've gotten everything set up and working nicely except my database. I'm running a CentOS 6.5 guest box on an OSX host.</p>
  
  <p><strong>My problem:</strong> I need my database to be completely persistent so I can vagrant up/destroy as many boxes as I need to, but the mysql persists.</p>
  
  <p><strong>My solution #1:</strong> I initially mounted a synced folder using vboxsf. This works pretty well and seems to be my best option so far, but performance is pretty bad. Query-intensive pages on my dev sites take 1-3 seconds to load whereas they might normally take under a second to load.</p>
  
  <p><strong>My solution #2:</strong> I then tried mounting a synced folder using nfs because the performance should be much better. The issue here is that mysql complains b/c, given the nature of nfs, it can't chown the data directory to the mysql:mysql user. I get the following errors when trying to start up the mysqld service:</p>
  
  <p><code>chown: changing ownership of '/www/mysql': Operation not permitted</code></p>
  
  <p><code>chmod: changing permissions of '/www/mysql': Permission denied</code></p>
  
  <p>Sooo, my question is: are there any better ways to accomplish what I need? I feel like NFS would be the best solution, but I don't know how to get around the whole ownership/permission issues automatically with Vagrant. Any help would be appreciated.</p>