brew install [email protected] results in missing mysql bin
I needed MySQL 5.7 installed so I ran brew install [email protected]
.
When I do brew services list
I see [email protected] started
.
When I try mysql -uroot
I get an error that the bin could not be found.
This didn't happen when I simply ran brew install mysql
but of course that results in the wrong version number.
Output of ps -A | grep *mysql*
as requested:
66836 ttys002 0:00.01 grep *mysql*
The output of find / -name *mysql*
is contained in this gist.
To try to fix this I ran this:
ln -sfv /usr/local/opt/[email protected]/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/[email protected]
Then I added this to .bash_profile
and reloaded:
export MYSQL_PATH=/usr/local/Cellar/[email protected]/5.7.22
export PATH=$PATH:$MYSQL_PATH/bin
However, now I get this error when I type mysql -uroot
:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
When I run mysqld
I get this output:
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.
Looks like the prior installation of mysql8 created bad DB files, which must be deleted manually:
rm -rf /usr/local/var/mysql # WARNING: this deletes all your data!
brew uninstall [email protected]
brew install [email protected]
Note: this solution is intended to repair fresh installations only. It potentially results in loss of data.
For me, I had this error on OS X 10.13 after upgrading from El Capitan. I installed MySQL via homebrew, specifically 5.7, and then when I ran "mysql" from the command line it errored that the command was not found.
My fix was using Homebrew to link the installed MySQL version since 5.7 is not the latest version of MySQL:
brew link [email protected] --force
After this it recognized "mysql" as a command for me. Then running this commands logs me in via the command line:
mysql -u root
To start the service I used this command:
brew services start [email protected]
Good stuff, looks like we've found the location of the binary and set a path accordingly. It appears as though brew services list wasn't providing completely reliable output re: the actual status of the server.
The socket error you're seeing should be due to the fact that the mysql server isn't running.
The error seems to be related to the log line:
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!
There's a few possible solutions to this particular error - Server Fault, Github, Github 2
The serverfault suggestion looks well written and promising, if it doesn't work you may want to try the github solutions.