Local Community

Location of database files and software

I’m using Local 6.4.3 to manage WordPress sites on a Windows 10 machine. I want to include the database files for each site in my regular backup routines, but I can’t find those files. Local reports that all the sites are using MySQL 8.0.16 as their database engine, but there is absolutely no evidence that MySQL has even been installed on my system (I’ve looked in C:\Program Files, C:\Program Files (x86), C:\, C:\Users\[User Name]\Local Sites, etc.). I’ve also searched the entire C: drive extensively and can find no instance of regular MySQL data files (*.myd). Can someone tell me:

  1. Where are the actual database files located?
  2. Where, and under what name, is MySQL typically installed?

Hi @silverblatt! When you’re looking at a site in Local, under the site name you should see Go to Site Folder. What pulls up when you click on that? Here is a screenshot from my app: Image 2022-10-05 at 9.52.31 AM

Once open if I click on conf then I see mysql

Thanks for responding, Nick. When I click on “Go to site folder” it opens an Explorer Window showing the contents of the site folder, which contains three sub-folders. When I drill down into the conf sub-folder, and then from there down into the mysql sub-folder, I see only a file named my.cnf.hbs. Is that the actual database file?

Also, do you know where the MySQL software is installed? I can’t find any evidence of it in the Program Files or Program Files (x86) folders, or in Control Panel, Programs and Features.

Hi @silverblatt!

Apologies I gave you the wrong direction. If you open the site files back up to where you see app, conf and logs, you’ll actually click into app. There you should see a sql folder with your database in it.

Nick, the file in the sql folder (local.sql) is just an SQL script for dropping, rebuilding and repopulating the database. As far as I know, that’s not the actual database itself, but rather just a script for creating it.

What I’m trying to find are (a) the actual database files themselves; and (b) the location of the MySQL software which seems to be working as intended but doesn’t appear in any of the places one normally finds software installed on a Windows machine,. In other words, software files (.EXEs, .DLLs, etc.) are normally installed in either the Program Files or the Program Files (x86) folder, and there is normally an entry for each installed application in Control Panel, Programs and Features. On my machine, there is no evidence of MySQL in any of those places, yet Local WP reports that all my sites are using MySQL and the sites themselves function normally on my local machine.

Hi @silverblatt -

the file in the sql folder (local.sql) is just an SQL script for dropping, rebuilding and repopulating the database. As far as I know, that’s not the actual database itself, but rather just a script for creating it.

The script you’re referring to is in fact the database.

What you’re looking for in regards to SQL is compiled and packaged within the app itself. It is running “inside” of Local, which is why you’re not finding it as a separate install.

For some further insight, your data physically lives here: Image 2022-10-05 at 3.20.18 PM

Thanks, Nick - that clears up the mystery.

Just for my own curiosity and edification (I’m a programmer, too) I’m wondering if you can confirm something for me. I imagine Local WP works something like this: When a WordPress site is started, the site gets database service via Local WP rather than a separate installation of MySQL. And to provide that service, Local WP reads the local.sql file and uses the contents to create and populate the database, tables, stored procedures etc. on the fly, either in temporary storage or in memory. When the WordPress site is stopped, the current state of the database is saved to the local.sql file. Is that a reasonably accurate description of how it all works?

My assumption that the database is created in temporary storage or in memory is based on the fact that as I’m changing the site’s contents in real time (by modifying or adding blog posts, for instance), the Last Modified time-stamp on the local.sql file remains unchanged. Based on that time-stamp, it seems that the file is only updated when the site is shut down. So the database changes that have accumulated while the site is up must have been saved either in memory or to some temporary storage location.

I’m curious about all this because I’ve spent many years building database applications (mostly MS SQL Server) and for those applications the database itself is always a separate file (or files) from any script file that may manipulate the database.

Thanks again for your help with this.

Hi @silverblatt!

The short answer to all of that is yes! You’re basically spot on. When you start a site, that kicks on the database engine along with PHP. Then you can work on your site, or access the database with Adminer. When you stop the site, everything is saved/updated before shutting down.

OK, got it. Thanks again for your assistance.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.