Allow configurable location for "userdata/run" folder

Moving Application support data to a different location

Is there a way to move the Application Support/Local/run/ folder to a different location? is currently taking a lot of space from my small hard drive.

What I’ve seen is basically related to mysql DB files so I was wondering if there’s a way to define a different folder to move that.
I already tried creating a symlink but no luck there because I got this error

{“level”:“error”,“message”:“Database did NOT respond to ping after 5 tries on any address.”,“service”:“mysql”,“serviceBinVersion”:“8.0.35”,“stack”:“Error: Command failed: %%userDataPath%%/lightning-services/mysql-8.0.35+4/bin/darwin-arm64/bin/mysqladmin ping\n\u0007mysqladmin: connect to server at ‘localhost’ failed\nerror: ‘Can’t connect to local MySQL server through socket ‘%%site.runData%%/mysql/mysqld.sock’ (2)’\nCheck that mysqld is running and that the socket: ‘%%site.runData%%/mysql/mysqld.sock’ exists!\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at ChildProcess.exithandler (node:child_process:414:12)\n at ChildProcess.emit (node:events:518:28)\n at ChildProcess.emit (node:domain:489:12)\n at maybeClose (node:internal/child_process:1101:16)\n at ChildProcess._handle.onexit (node:internal/child_process:304:5)”,“thread”:“main”,“timestamp”:“2025-07-30T20:31:13.283Z”}


System Details

  • Local Version: Version 9.2.5+6810

  • Operating System (OS) and OS version: Mac OS Sonoma 14.7.6


Local Logs

Local Log

local-lightning.log (7.7 KB)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hey @hugosolar! We’ve had some users run into this issue in the past but I’m not aware of a solution for shifting this around.

Do you have one large project in Local or many different projects? Would it be possible to back up, export and save any projects to remove them from the app?

Hey @Nick-B ! I already browse the forum and couldn’t find any solution yet and yes! I have two large sites I’m currently working on so it’s not an option to remove one. Besides of that I have a Macbook Air with a small 256gb HD. I know it’s not the ideal but I do have a 1tb external HD where I store my Local sites.
That’s why I tried to move the run folder to that external drive and doing a symlink but the site doesn’t start :frowning:
I think It could be a nice feature to have the ability to configure those directories in a sort of advanced settings

1 Like

I’ll reach back out to our Devs and continue talks about this @hugosolar - in the meantime do either of these sites have anything that could be optimized? Media files that could be offloaded? Database bloat that could be cleaned? Backups that could be removed?

1 Like

Thanks @Nick-B let me know if I can help with anything (I can try things or beta test if needed)

about the sites, there’s not much to optimize honestly, is just large DBs and I’m using proxy for media files so that’s not an issue :frowning:

1 Like

Hey @hugosolar – Thanks for bringing this up!

To answer your question specifically, there isn’t a way currently to move the run folder to a different location.

I totally see how this can be an issue, so I’m converting this topic to a Feature Request to allow for voting and prioritizing and updating the description a bit to be more specific about the ask. LMK if I summarized things correctly.

As to why things are this way, I don’t think we’ve purposely built it like this, it’s just that Electron made it easy to have a userdata folder.

One positive side effect of not saving the raw DB files to be next to the working site files (ie, ~/Local Sites/<sitename> ) is that it’s just a little harder to corrupt the run files and break the site. For example, many users configure something like Dropbox to sync their ~/Local Sites folder. If the run files were synced as well, I could see a pretty easy path towards Dropbox mangling the raw DB files and borking a site.

One other potential issue that I haven’t explored is that I know that there have been a few bugs in the past related to Windows permissions and working with files on a separate partition. I’m not sure how the various lightning services (php, mysql, apache, nginx) would respond to being on different partitions. Maybe it would be just fine, but definitely an interesting problem to investigate!

One other thing, I’ve never taken a real deep dive into how MySQL stores it’s raw data, but I know that it’s typically the thing that eats up a lot of disk space. Taking a closer look at my run folder with just a minimal WP site shows a pretty large amount of disk space being used:

★ Local/run * $ du -sh ./3F2HpWi2n/mysql/data/* | sort -h
  0B	3F2HpWi2n/mysql/data/#innodb_temp/
4.0K	3F2HpWi2n/mysql/data/auto.cnf
4.0K	3F2HpWi2n/mysql/data/binlog.000002
4.0K	3F2HpWi2n/mysql/data/binlog.index
4.0K	3F2HpWi2n/mysql/data/ca-key.pem
4.0K	3F2HpWi2n/mysql/data/ca.pem
4.0K	3F2HpWi2n/mysql/data/client-cert.pem
4.0K	3F2HpWi2n/mysql/data/client-key.pem
4.0K	3F2HpWi2n/mysql/data/ib_buffer_pool
4.0K	3F2HpWi2n/mysql/data/private_key.pem
4.0K	3F2HpWi2n/mysql/data/public_key.pem
4.0K	3F2HpWi2n/mysql/data/server-cert.pem
4.0K	3F2HpWi2n/mysql/data/server-key.pem
 32K	3F2HpWi2n/mysql/data/mysql/
112K	3F2HpWi2n/mysql/data/sys/
192K	3F2HpWi2n/mysql/data/#ib_16384_0.dblwr
552K	3F2HpWi2n/mysql/data/binlog.000001
1.6M	3F2HpWi2n/mysql/data/performance_schema/
1.8M	3F2HpWi2n/mysql/data/local/
8.2M	3F2HpWi2n/mysql/data/#ib_16384_1.dblwr
 12M	3F2HpWi2n/mysql/data/ibdata1
 16M	3F2HpWi2n/mysql/data/undo_001
 16M	3F2HpWi2n/mysql/data/undo_002
 28M	3F2HpWi2n/mysql/data/mysql.ibd
192M	3F2HpWi2n/mysql/data/#innodb_redo/

Most of that data is in the #innodb_redo folder, which I think MySQL uses by pre-allocating disk space in order to temporarily write things before committing the data to the actual files. Something like a log to help avoid data corruption of the main, primary files. Anyway, you probably don’t want to tweak the various variables of MySQL to try and reduce that pre-allocated size because that might make the DB run in odd ways, but I mention it to provide some context around why things are so big.

3 Likes

Hey @ben.turner

thank you so much for this! the summary looks correct to me and I totally understand and I think are valid caveats and concerns.

That’s something I’ve been thinking of as well and that’s why I was very careful with my DB before setting up the symlink as I know mysql raw files can be very fragile.
Also, moving these temporary data to a potential unstable external volume can cause unexpected issues too.
Having that as a “risky feature” worth the shot :smile: since this is my current scenario

du -sh */ 2>/dev/null | sort -hr
30G Czw15zxL6/
23G x5Jwb2tpG/
348M edtzMvS9z/
290M YJKcAZciv/
265M y_8vadRhN/
4.9M router/

and having that into such a small HD sucks :sad_but_relieved_face:

2 Likes

Those are some definitely chunky bois! :sob:

2 Likes