Мой sql сервер не работает после обновления и перезапуска Ma c - ОШИБКА 2002 (HY000): Не удается подключиться к локальному MySQL серверу через сокет '/tmp/mysql.sock' - PullRequest
0 голосов
/ 29 марта 2020

Я установил mysql@5.7 в ma c с помощью homebrew и работал нормально, но после обновления и перезапуска ma c я получаю следующую ошибку при попытке войти в систему mysql.

brew services mysql@5.7 показывается запущенным.

Но когда я пытаюсь mysql -h localhost -u root -p я получаю следующую проблему

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Я видел, что это распространенная проблема, но не мог не могу найти правильное решение, кроме удаления mysql и переустановки.

У меня есть несколько схем с данными, которые нельзя потерять.

Как я могу исправить эту проблему, не потеряв никаких данных .

запустите mysqld, ниже вывод

2020-03-29T09:18:53.574205Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-03-29T09:18:53.574442Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2020-03-29T09:18:53.574475Z 0 [Note] mysqld (mysqld 5.7.29) starting as process 63912 ...
2020-03-29T09:18:53.576645Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2020-03-29T09:18:53.577756Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-03-29T09:18:53.577765Z 0 [Note] InnoDB: Uses event mutexes
2020-03-29T09:18:53.577768Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-03-29T09:18:53.577770Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-03-29T09:18:53.577956Z 0 [Note] InnoDB: Number of pools: 1
2020-03-29T09:18:53.578042Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-03-29T09:18:53.579042Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-03-29T09:18:53.586107Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-03-29T09:18:53.600619Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
2020-03-29 14:48:53 0x11014c5c0  InnoDB: Assertion failure in thread 4564764096 in file ut0ut.cc line 918
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:18:53 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68221 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
0   mysqld                              0x000000010b5fd139 my_print_stacktrace + 58
1   mysqld                              0x000000010b57cd1b handle_fatal_signal + 696
2   libsystem_platform.dylib            0x00007fff6f542b5d _sigtramp + 29
3   mysqld                              0x000000010bdefa02 _ZL19ib_logfile_basename + 123732
4   libsystem_c.dylib                   0x00007fff6f3fc6a6 abort + 127
5   mysqld                              0x000000010b8a9f88 _Z23ut_dbg_assertion_failedPKcS0_m + 161
6   mysqld                              0x000000010b7ed947 _ZN2ib5fatalD2Ev + 91
7   mysqld                              0x000000010b7ed985 _ZN2ib5fatalD1Ev + 9
8   mysqld                              0x000000010b69555a _ZL18fil_node_open_fileP10fil_node_t + 2411
9   mysqld                              0x000000010b69ee6e _ZL23fil_node_prepare_for_ioP10fil_node_tP12fil_system_tP11fil_space_t + 191
10  mysqld                              0x000000010b69f556 _Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_ + 796
11  mysqld                              0x000000010b66628c _ZL17buf_read_page_lowP7dberr_tbmmRK9page_id_tRK11page_size_tb + 408
12  mysqld                              0x000000010b6663e3 _Z13buf_read_pageRK9page_id_tRK11page_size_t + 56
13  mysqld                              0x000000010b651cf7 _Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb + 953
14  mysqld                              0x000000010b7db4fa _Z31trx_rseg_get_n_undo_tablespacesPm + 251
15  mysqld                              0x000000010b7bef4b _Z34innobase_start_or_create_for_mysqlv + 6608
16  mysqld                              0x000000010b6eea25 _ZL13innobase_initPv + 3636
17  mysqld                              0x000000010b070508 _Z24ha_initialize_handlertonP13st_plugin_int + 78
18  mysqld                              0x000000010b4cc1fd _ZL17plugin_initializeP13st_plugin_int + 79
19  mysqld                              0x000000010b4cbcfb _Z40plugin_register_builtin_and_init_core_sePiPPc + 707
20  mysqld                              0x000000010b571cfd _Z11mysqld_mainiPPc + 2912
21  libdyld.dylib                       0x00007fff6f3573d5 start + 1
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

1 Ответ

0 голосов
/ 29 марта 2020

Вы проверили, работает ли сервис? Попробуйте запустить mysql.server status, и он сообщит вам, работает ли он, если не использовать mysql.server start для запуска службы

Поскольку ваша команда brew может быть другой: brew services start mysql

Также убедитесь, что MySQL имеет правильные разрешения: sudo chown -R _mysql:mysql /usr/local/var/mysql

...