Brew postinstall mysql@5.7在数据目录为空时抱怨数据目录不为空 [英] Brew postinstall mysql@5.7 complaining about data directory not empty when it is empty

查看:166
本文介绍了Brew postinstall mysql@5.7在数据目录为空时抱怨数据目录不为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac Mojave上安装mysql 5.7时遇到很多麻烦,(运行'brew install mysql@5.7')

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).

因此,删除目录/usr/local/var/mysql中的所有内容(mysql表示不为空)后,重新运行postinstall命令时,我仍然会收到相同的消息...(这似乎很令人讨厌,MySQL正在填充数据目录,然后抱怨它不为空?!)

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

尝试以root身份启动mysql会出现错误:

Trying to start mysql as root gives error:

[08:04:41] [〜/tmp] #sudo/usr/local/opt/mysql@5.7/bin/mysql.server start 密码:正在启动MySQL .....错误!服务器退出而不更新 PID文件(/var/run/mysqld/mysqld.pid).

[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).

现在试图追随StackOverflow帖子的日子越来越长,,没有一个正在工作...

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.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

推荐答案

尝试使用远离mysql目录的数据目录,即,如果mysql位于/usr/local/mysql中,则将数据目录用作/var/data. /p>

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.

这篇关于Brew postinstall mysql@5.7在数据目录为空时抱怨数据目录不为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆