ERROR 2002 (HY000): Can't connect to local server through socket

When launching a Local website I received the dreaded “Error establishing a database connection” WordPress error. In (macOS) Terminal when I try to run:

wp db check

I receive the following error:

Got error: 2002: Can’t connect to local server through socket '/Users/(me)/Library/Application Support/Local/run/go89fOUuq/mysq'

This only happens in one of my Local sites, the rest seem to be fine which leads me to believe this particular database is corrupted.

I attempted to restore the database from a TimeMachine backup by restoring…

/Users/(me)/Library/Application Support/Local/run/go89fOUuq/mysql

…and…

/Users/(me)/Projects/(client)/local/app/sql/local.sql

…but I’m still receiving the same error.

Questions:

  1. Is this indeed a database corruption?
  2. If #1 is true, how come a TimeMachine restoration isn’t working?

Thanks!
local-lightning.log (646.5 KB)

System Details

  • Which version of Local is being used? 6.4.3+6116

  • What Operating System (OS) and OS version is being used? macOS Monterey 12.6

Help anyone please?

Hi @ericksonstudio can you share a copy of your Local Log? Retrieving Local’s Log File

1 Like

Absolutely. Thank you!

local-logs.zip (199.1 KB)

Anything? I’m really in a bind. Thank you kindly!

Hi @ericksonstudio - thank you for your patience! I’m still looking in to this one. You mentioned that your other sites in Local work normally correct? Was this a new site you just imported or was it a previously working site that stopped suddenly? Was it locally built or is it currently hosted somewhere?

1 Like

Other Local sites are working correctly, Yes.

It was one I was building starting in Local a number of months ago. It is not hosted anywhere yet.

Thanks!

Hey @ericksonstudio – thanks for those logs, it really helps in digging into the issue!

The main thing I’m seeing are lines that look like this:

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"00:06:47 UTC - mysqld got signal 11 ;","timestamp":"2022-09-30T00:06:47.365Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.","timestamp":"2022-09-30T00:06:47.365Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"Thread pointer: 0x7fa9dc80e400","timestamp":"2022-09-30T00:06:47.365Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"Attempting backtrace. You can use the following information to find out","timestamp":"2022-09-30T00:06:47.365Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"where mysqld died. If you see no messages after this, something went","timestamp":"2022-09-30T00:06:47.366Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"terribly wrong...","timestamp":"2022-09-30T00:06:47.366Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"stack_bottom = 70000a7a6f50 thread_stack 0x30000","timestamp":"2022-09-30T00:06:47.366Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"0   mysqld                              0x000000010ebcdfdc my_print_stacktrace(unsigned char*, unsigned long) + 60","timestamp":"2022-09-30T00:06:47.381Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"1   mysqld                              0x000000010dfd5bbc handle_fatal_signal + 428","timestamp":"2022-09-30T00:06:47.381Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2   libsystem_platform.dylib            0x00007ff8118ecdfd _sigtramp + 29","timestamp":"2022-09-30T00:06:47.382Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"3   ???                                 0x00007fa9db845480 0x0 + 140367509083264","timestamp":"2022-09-30T00:06:47.382Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"4   mysqld                              0x000000010eccb466 btr_cur_search_to_nth_level(dict_index_t*, unsigned long, dtuple_t const*, page_cur_mode_t, unsigned long, btr_cur_t*, unsigned long, char const*, unsigned long, mtr_t*) + 6118","timestamp":"2022-09-30T00:06:47.382Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"5   mysqld                              0x000000010ef278c4 row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long) + 3700","timestamp":"2022-09-30T00:06:47.382Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"6   mysqld                              0x000000010edf0823 ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function) + 691","timestamp":"2022-09-30T00:06:47.382Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"7   mysqld                              0x000000010db92286 handler::index_read_idx_map(unsigned char*, unsigned int, unsigned char const*, unsigned long, ha_rkey_function) + 86","timestamp":"2022-09-30T00:06:47.383Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"8   mysqld                              0x000000010db8a1ec handler::ha_index_read_idx_map(unsigned char*, unsigned int, unsigned char const*, unsigned long, ha_rkey_function) + 236","timestamp":"2022-09-30T00:06:47.383Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"9   mysqld                              0x000000010de25d16 read_const(TABLE*, TABLE_REF*) + 326","timestamp":"2022-09-30T00:06:47.383Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"10  mysqld                              0x000000010de2593f join_read_const_table(JOIN_TAB*, POSITION*) + 303","timestamp":"2022-09-30T00:06:47.384Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"11  mysqld                              0x000000010de6a5a1 JOIN::extract_func_dependent_tables() + 945","timestamp":"2022-09-30T00:06:47.384Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"12  mysqld                              0x000000010de60a5d JOIN::make_join_plan() + 957","timestamp":"2022-09-30T00:06:47.384Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"13  mysqld                              0x000000010de5c918 JOIN::optimize() + 2408","timestamp":"2022-09-30T00:06:47.384Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"14  mysqld                              0x000000010dec4284 SELECT_LEX::optimize(THD*) + 228","timestamp":"2022-09-30T00:06:47.385Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"15  mysqld                              0x000000010dec52c0 Sql_cmd_dml::execute_inner(THD*) + 304","timestamp":"2022-09-30T00:06:47.385Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"16  mysqld                              0x000000010dec5030 Sql_cmd_dml::execute(THD*) + 1248","timestamp":"2022-09-30T00:06:47.385Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"17  mysqld                              0x000000010de79ef0 mysql_execute_command(THD*, bool) + 4368","timestamp":"2022-09-30T00:06:47.385Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"18  mysqld                              0x000000010de77773 mysql_parse(THD*, Parser_state*) + 995","timestamp":"2022-09-30T00:06:47.386Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"19  mysqld                              0x000000010de752f9 dispatch_command(THD*, COM_DATA const*, enum_server_command) + 4889","timestamp":"2022-09-30T00:06:47.386Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"20  mysqld                              0x000000010de77033 do_command(THD*) + 467","timestamp":"2022-09-30T00:06:47.386Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"21  mysqld                              0x000000010dfbbbe4 handle_connection(void*) + 372","timestamp":"2022-09-30T00:06:47.386Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"22  mysqld                              0x000000010efef64c pfs_spawn_thread(void*) + 316","timestamp":"2022-09-30T00:06:47.386Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"23  libsystem_pthread.dylib             0x00007ff8118d74e1 _pthread_start + 125","timestamp":"2022-09-30T00:06:47.387Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"24  libsystem_pthread.dylib             0x00007ff8118d2f6b thread_start + 15","timestamp":"2022-09-30T00:06:47.387Z"}

That message basically means that something is wrong with the raw DB files. This might be due to the DB being corrupted, or in some way crashed. The best way to mover forward is to re-import the site from a previous backup.

You mention that you restored the app/sql/local.sql file from TimeMachine.

I think you can zip up that file along with the wp-content folder of the site, and then import into Local by dragging and dropping the zip onto Local. More details about how to create that zip folder can be found in this help doc:

Let us know how that goes!

1 Like

Fabulous! That worked. Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! :pray::pray::pray:

1 Like

:larry_heart: Awesome – Glad it worked!

Have a great day @ericksonstudio !

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