【问题标题】:Unable to install MySQL 5.7 on MacOS Mojave with Homebrew无法使用 Homebrew 在 MacOS Mojave 上安装 MySQL 5.7
【发布时间】:2019-12-25 18:25:05
【问题描述】:

我正在尝试在 macOS Mojave 上使用 Homebrew 安装 MySQL 5.7,但是我收到以下错误:

[错误] 无法打开文件 '/var/log/mysql/error.log' 出错 日志记录:不允许操作 [错误] 中止

我已经尝试自己创建文件,因此 Homebrew 不需要创建它,但它仍然会抱怨。 /var/log 里面有这个

drwxrwxrwx 3 _mysql _mysql 96 20 Aug 21:25 mysql

/var/log/mysql 里面我有这个:

-rwxrwxrwx 1 _mysql _mysql 0 20 Aug 21:25 error.log

(我手动将它们设置为 777 并归 mysql:mysql 所有)

这是完整的输出:

$ brew install mysql@5.7
==> Installing dependencies for mysql@5.7: openssl
==> Installing mysql@5.7 dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2s.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/c4/c4a762d719c2be74ac686f1aafabb32f3c5d5ff3a98935c4925a1ddb9c750ee1?__gda__=exp=1566309208~hmac=eddcaa
######################################################################## 100.0%
==> Pouring openssl-1.0.2s.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

==> Summary
????  /usr/local/Cellar/openssl/1.0.2s: 1,795 files, 12.0MB
==> Installing mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.27.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e2/e232cc9150f4f8d65ce5e24e010fa09ea3da90029bfd98036258d4370f75e798?__gda__=exp=1566309224~hmac=f2bf1a
######################################################################## 100.0%
==> Pouring mysql@5.7-5.7.27.mojave.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.27/bin/mysqld --initialize-insecure --user=crmpicco --basedir=/usr/local/Cellar/mysql@5.7/5.7.27 --datadir=/usr/lo
Last 15 lines from /Users/crmpicco/Library/Logs/Homebrew/mysql@5.7/post_install.01.mysqld:
2019-08-20 21:43:07 +0800

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

2019-08-20T13:43:07.725766Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-08-20T13:43:07.730312Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-08-20T13:43:07.735699Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Operation not permitted
2019-08-20T13:43:07.735780Z 0 [ERROR] Aborting

Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mysql@5.7`
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

For compilers to find mysql@5.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start
==> Summary
????  /usr/local/Cellar/mysql@5.7/5.7.27: 320 files, 232.3MB
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

==> mysql@5.7
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

For compilers to find mysql@5.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start

【问题讨论】:

  • 是的,类似的问题,让 mysql 5.7 与 Mojave 一起工作的噩梦(使用 brew):stackoverflow.com/questions/59243466/… ...希望它像在 Ubuntu 上一样简单,您可以在其中安装一个包并且它可以工作...

标签: mysql macos permissions homebrew mysql-5.7


【解决方案1】:

从 brew install 的输出来看,它看起来像是已安装。 似乎这是 /var/log/mysql/error.log 上的权限问题

尝试更改 /var/ 文件夹的权限

【讨论】:

  • 嗯,是的,问题是应该授予目录什么权限。更改整个/var 文件夹的权限似乎不对。
猜你喜欢
  • 2019-03-14
  • 1970-01-01
  • 2021-06-11
  • 2020-02-11
  • 2022-12-04
  • 2018-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多