Can you please explain the SQL dump folders in more detail?

I see the database is separated into separate files for each table in the app/sql folder. I’m very curious about all of this, and I’ve done a bunch of digging in this community and come up with some info about it:

  • There is an automatic database dump each time you stop your container. The site’s individual SQL files automatically dump into app/sql whenever a site is stopped or restarted.

  • Each SQL file is an individual table in the WP database

  • If there’s corruption (like your computer crashing), chances are that database dump won’t export correctly.

  • The raw SQL data is inside the container in /var/lib/mysql

My question here is, what is the difference between the individual dump in app/sql, and the raw data in /var/lib/mysql? How does Local use each?

I read in a previous support question that changing the database file in app/sql will NOT update the database in your WordPress install, and in that case, Local will just rebuild that folder from the /var/lib/mysql folder. Is this true, and why?

Hey @jamieschmid, happy to help clarify some more!

The raw data that you would find in the /var/lib/mysql folder is the active MySQL database files in the Local VirtualMachine within VirtualBox.

The SQL files in the /app/sql/ folder are simply a safety net backup in case something happens with the VirtualMachine. If something did crash or get corrupted in the VirtualMachine, you could certainly attempt to try a recovery using the /var/lib/mysql data if you still had access to it. If not, you would at least have the SQL files from the last time the VM was successfully shut down (better than nothing at all).

In the case that there was a problem with the VM and it had to be removed or recreated, Local will import the SQL table files from the /app/sql folder.

1 Like