Site not starting after system reset

Issue Summary

Hi, i reset my mac and only saved the /Local Sites/ folder and /Application Support/Local/ as a backup and it has no mysql.sock file available for any site. I thought restoring these two will work but i was wrong. Is there any possibility to get it working or i have lost the database file for all sites? if it is possible to manually export the .sql file for each site as i already have site content saved.

Troubleshooting Questions

  • I got the following error.
Error: Command failed: /Applications/Local.app/Contents/Resources/extraResources/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqladmin ping
mysqladmin: [Warning] World-writable config file '/Users/aryanraj/Library/Application Support/Local/run/YA0dUFP44/conf/mysql/my.cnf' is ignored.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
at ChildProcess.exithandler (node:child_process:407:12)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Socket.<anonymous> (node:internal/child_process:451:11)
at Socket.emit (node:events:527:28)
at Pipe.<anonymous> (node:net:709:12)

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Creating a new site is working.

Replication

System Details

iMac Late 2015, Monterey 12.6.7

Security Reminder

Hi there @aryan -

Can you explain your workflow a little more here?

Did you export these files, restore your computer, reinstall Local, and try to swap the files out?

A typical workflow would be to export your sites with a .zip following this help doc, but perhaps the database files you need are located in one of these files.

Thank you,

Sam

I am sorry, just checked the sql folder and it has the .sql file. Yes, i exported the files folder /Local Sites/ and /Application Support/Local/ simply using finder and then replaced with fresh install.

I have the .sql file so i am saved however i may need to recreate sites as they no longer start. anyway to fix that or alternative options as i have about 100+ local sites.

Thank you.

I tried to replicate this and wasn’t successful, however I didn’t do a full system reset. Instead, I basically:

  1. Created a tarball of those folders
  2. Deleted the folders
  3. Quit Local
  4. Restored the folders
  5. Started Local and Accessed a site

When I take a closer look at the error message you provided, these lines stand out to me:

mysqladmin: [Warning] World-writable config file '/Users/aryanraj/Library/Application Support/Local/run/YA0dUFP44/conf/mysql/my.cnf' is ignored.
...
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

The /tmp/mysql.sock location is the default location for mysql. Local sites don’t use that default location, and instead use a socket location within the run folder which looks like:

~/Library/Application Support/Local/run/9H426W0MV/php/php-fpm.socket

I think what might be happening is that:

  1. Local tries to start mysql
  2. Because the config file is world-writable, Mysql doesn’t load the individual site configuration located at .../run/YA0dUFP44/conf/mysql/my.cnf, and so falls back to the default configuration using the default socket
  3. The default socket won’t line up with the socket needed for the individual site, so Local can’t fully start the site and an error is thrown.

I wonder what kind of file permissions you have, and if you need to adjust the permissions?

You can list the file permissions for all your sites by opening a terminal and running this find command:

find ~/Library/Application\ Support/Local/ -name 'my.cnf' -exec ls -alh {} \;

I think you’ll want to see lines that look like what’s on my computer (note the -rw-r--r-- part, aka “644 perms”):

If you have something different, like -rwxrwxrwx at the start of the lines, then I think you’ll want to reset those perms. To do this, ensure you still have a backup of these sites, quit Local, and then run this command within the terminal:

find ~/Library/Application\ Support/Local/ -name 'my.cnf' -exec chmod 644 {} \;

Can you take a look at those file permissions and see if running that command to set the files to 644 permissions helps? If you still have problems, can you provide the output of what those file permissions are?

1 Like

Hi, You are a lifesaver. Thank you. It was starting with -rwxrwxrwx and changing the permission using the second code worked. However, I may need to regenerate the SSL which is fine.

Is there any doc article available for safely keep and transfer these sites incase of system reset or moving to a new machine?

Thanks again.

1 Like

Hi @aryan!

You can use our Cloud Blackups feature to backup and store copies of your sites:

Cloud Backups

You can also right-click any site to create a simple zip export that you could then offload yourself to storage to retain a copy. No need to utilize any specialized backup plugin.

Hi, i am talking about moving multiple sites, assume a complete setup migration to a new machine.

Thanks.

There isn’t a real simple and easy way to migrate all your sites in bulk to a new machine. You’d still have to manually back them up to Cloud or export their zips and then move them over to the new machine for re-import.

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