在'brew install mysql`之后,mysqld无法启动,抱怨未知选项" - skip-locking"。我该如何解决?

时间:2018-03-27 17:52:02

标签: mysql

这里有很多细节......

OS: OS X El Capitan 10.11.6
$ brew --version
Homebrew 1.5.12
Homebrew/homebrew-core (git revision af232; last commit 2018-03-27)

我无法再连接到我的本地mysql,所以我按照https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks的说明重新安装了brew,包括在卸载mysql后重新启动。

运行mysql_install_db成功:

2018-03-27 10:17:01 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-03-27 10:17:01 [NOTE]    Creating data directory /usr/local/var/mysql
2018-03-27 10:17:01 [NOTE]    Generating random password to /Users/me/.mysql_secret...done.
2018-03-27 10:17:01 [NOTE]    Executing /usr/local/opt/mysql/bin/mysqld --bootstrap --datadir=/usr/local/var/mysql --lc-messages-dir=/usr/local/opt/mysql/share/mysql --lc-messages=en_US --basedir=/usr/local/opt/mysql
2018-03-27 10:17:03 [NOTE]    Creating system tables...done.
2018-03-27 10:17:03 [NOTE]    Filling system tables with data...done.
2018-03-27 10:17:04 [NOTE]    Filling help table with data...done.
2018-03-27 10:17:04 [NOTE]    Creating user for internal session service...done.
2018-03-27 10:17:04 [NOTE]    Creating default user root@localhost
2018-03-27 10:17:04 [NOTE]    Creating default proxy root@localhost
2018-03-27 10:17:04 [NOTE]    Creating sys schema
2018-03-27 10:17:06 [NOTE]    done.
2018-03-27 10:17:07 [WARNING] The bootstrap log isn't empty:
2018-03-27 10:17:07 [WARNING] 2018-03-27T17:17:01.939957Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

当我尝试运行mysql.server start时,我在命令行上收到此错误消息:

......错误!服务器退出而不更新PID文件(/usr/local/var/mysql/myhostname.pid)。

这是/usr/local/var/mysql/myhostname.err中的错误:

2018-03-27T17:30:40.451904Z 0 [ERROR] unknown option '--skip-locking'

没有/etc/my.cnf个文件。

这是我从/usr/local看到的内容:

find Cellar/mysql/ var/mysql -name my.cnf
Cellar/mysql//5.7.21/.bottle/etc/my.cnf

$ cat Cellar/mysql//5.7.21/.bottle/etc/my.cnf
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1

我还在set -x添加了/usr/local/Cellar/mysql/5.7.21/bin/mysqld_safe,这里是用于启动的命令行:

nohup /usr/local/Cellar/mysql/5.7.21/bin/mysqld \
    --basedir=/usr/local/Cellar/mysql/5.7.21 \
    --datadir=/usr/local/var/mysql \
    --plugin-dir=/usr/local/Cellar/mysql/5.7.21/lib/plugin \
    --log-error=Erics-MacBook-Pro-601.err \
    --pid-file=/usr/local/var/mysql/Erics-MacBook-Pro-601.pid \
    --socket=/tmp/mysql.sock \
    --port=3306

那么注入--skip-locking选项在哪里?有什么建议吗?

1 个答案:

答案 0 :(得分:0)

在〜/ .my.cnf

中找到它

[添加到appease stackoverflow的额外文本]