1

Having a lot of trouble installing mysql 5.7 on Mac Mojave, (ran 'brew install mysql@5.7')

on initial install, got msg saying postinstall was not completed successfully (please see msg below).

So, after I delete everything in the directory /usr/local/var/mysql (which mysql says is not empty), I STILL get same message when re-running postinstall command ... (which is quite annoying seems MySQL is populating the data dir then complaining it is not empty?!)

[08:02:48][~/tmp]#brew postinstall mysql@5.7
==> Postinstalling mysql@5.7
==> /usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld --initialize-insecure --user=gert --basedir=/usr/local/Cellar/mysql@5.7/5.7.28 --datadir=/usr/local/var/my  Last 15 lines from /Users/gert/Library/Logs/Homebrew/mysql@5.7/post_install.01.mysqld: 2019-12-09 08:03:39 +0200

/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld
--initialize-insecure
--user=gert
--basedir=/usr/local/Cellar/mysql@5.7/5.7.28
--datadir=/usr/local/var/mysql
--tmpdir=/tmp

2019-12-09T06:03:39.151987Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details). 2019-12-09T06:03:39.154025Z 0 

[ERROR] --initialize specified but the data directory has files in it. Aborting. 2019-12-09T06:03:39.154074Z 0 [ERROR] Aborting

Trying to start mysql as root gives error:

[08:04:41][~/tmp]#sudo /usr/local/opt/mysql@5.7/bin/mysql.server start Password: Starting MySQL ..... ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid).

Banging head against wall for days now trying to follow StackOverflow posts MySql server startup error 'The server quit without updating PID file ', none of which is working ...

My my.cnf:

[mysqld]
# Only allow connections from localhost
#bind-address = 127.0.0.1
#SO posts said to comment out the above ...

pid-file    = /var/run/mysqld/mysqld.pid  #Checked, this folder + file exists, with write permissions
gvanto
  • 1,936
  • 3
  • 21
  • 26
  • 1
    Are you sure it's completely empty, without even any invisible files? (Note that "." and ".." are *always* present, and shouldn't/can't be removed.) – Gordon Davisson Dec 09 '19 at 07:12
  • Yep, absolutely 100% sure. No hidden files either. Just did it again, same error (data folder not empty)... Fundamental bug here me thinks, either in MySQL or in Brew – gvanto Dec 09 '19 at 08:36

1 Answers1

0

Try using a data dir away from the mysql directory i.e if mysql is in /usr/local/mysql, use the data dir as /var/data.

root@photon [ /var ]# /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/var/data
2020-02-22T21:42:27.121230Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.19) initializing of server in progress as process 820
2020-02-22T21:42:35.018238Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.