brew install [email protected] não pode se conectar ao servidor MySQL local através do soquete

9

Eu precisava do MySQL 5.7 instalado no Mac OS High Sierra, então eu corri brew install [email protected] .

Quando eu faço brew services list , vejo [email protected] started admin /Users/admin/Library/LaunchAgents/[email protected] .

Saída de ps -A | grep *mysql* :

66836 ttys002    0:00.01 grep *mysql*

A saída de find / -name *mysql* está contida em esta essência .

Para tentar corrigir isso, eu corri isto:

ln -sfv /usr/local/opt/[email protected]/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/[email protected]

Em seguida, adicionei isso a .bash_profile e recarreguei:

export MYSQL_PATH=/usr/local/Cellar/[email protected]/5.7.22
export PATH=$PATH:$MYSQL_PATH/bin

No entanto, recebo esse erro quando digito mysql -uroot :

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

Isso não aconteceu quando eu simplesmente executei brew install mysql , mas é claro que isso resulta no número errado da versão.

Quando executo mysqld , obtenho esta saída:

2018-06-22T17:56:45.699316Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-22T17:56:45.699670Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-06-22T17:56:45.699751Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 40311 ...
2018-06-22T17:56:45.704301Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-06-22T17:56:45.706364Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-22T17:56:45.706389Z 0 [Note] InnoDB: Uses event mutexes
2018-06-22T17:56:45.706396Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-22T17:56:45.706402Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-22T17:56:45.706834Z 0 [Note] InnoDB: Number of pools: 1
2018-06-22T17:56:45.706983Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-22T17:56:45.708737Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-22T17:56:45.723231Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-22T17:56:45.739467Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
2018-06-22 10:56:45 0x7fffa8587380  InnoDB: Assertion failure in thread 140736017757056 in file ut0ut.cc line 942
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.
17:56:45 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 = 68220 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                              0x000000010d3b710a my_print_stacktrace + 58
1   mysqld                              0x000000010d337059 handle_fatal_signal + 700
2   libsystem_platform.dylib            0x00007fff70076f5a _sigtramp + 26
3   ???                                 0x0000000000000000 0x0 + 0
4   libsystem_c.dylib                   0x00007fff6fe141ae abort + 127
5   mysqld                              0x000000010d5a3059 _Z23ut_dbg_assertion_failedPKcS0_m + 161
6   mysqld                              0x000000010d5a5b2a _ZN2ib5fatalD2Ev + 88
7   mysqld                              0x000000010d5a5b63 _ZN2ib5fatalD1Ev + 9
8   mysqld                              0x000000010d44f13b _ZL18fil_node_open_fileP10fil_node_t + 2446
9   mysqld                              0x000000010d4588ef _ZL23fil_node_prepare_for_ioP10fil_node_tP12fil_system_tP11fil_space_t + 191
10  mysqld                              0x000000010d458fd3 _Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_ + 794
11  mysqld                              0x000000010d41fed6 _ZL17buf_read_page_lowP7dberr_tbmmRK9page_id_tRK11page_size_tb + 384
12  mysqld                              0x000000010d420026 _Z13buf_read_pageRK9page_id_tRK11page_size_t + 59
13  mysqld                              0x000000010d40bfc8 _Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb + 953
14  mysqld                              0x000000010d593357 _Z31trx_rseg_get_n_undo_tablespacesPm + 262
15  mysqld                              0x000000010d576eca _Z34innobase_start_or_create_for_mysqlv + 7007
16  mysqld                              0x000000010d4a8e0b _ZL13innobase_initPv + 3700
17  mysqld                              0x000000010ce1d86b _Z24ha_initialize_handlertonP13st_plugin_int + 79
18  mysqld                              0x000000010d288763 _ZL17plugin_initializeP13st_plugin_int + 79
19  mysqld                              0x000000010d28826b _Z40plugin_register_builtin_and_init_core_sePiPPc + 653
20  mysqld                              0x000000010d32cb56 _Z11mysqld_mainiPPc + 2929
21  libdyld.dylib                       0x00007fff6fd68015 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.
    
por EcomEvo 22.06.2018 / 20:12

1 resposta

23

Você provavelmente tem alguns diretórios restantes de outra instalação do mysql, que não foram removidos.

Eu resolvi isso fazendo o seguinte:

Primeiro, desinstale o mysql

brew uninstall [email protected]

Exclua as pastas / arquivos que não foram removidos

rm -rf /usr/local/var/mysql
rm /usr/local/etc/my.cnf

Reinstale o mysql e associe-o

brew install [email protected]
brew link --force [email protected]

Ativar e iniciar o serviço

brew services start [email protected]
    
por 11.07.2018 / 03:36