简体   繁体   English

无法使用Homebrew在MacOS Mojave上安装MySQL 5.7

[英]Unable to install MySQL 5.7 on MacOS Mojave with Homebrew

I am trying to install MySQL 5.7 with Homebrew on macOS Mojave, however I am getting the following error: 我试图在macOS Mojave上使用Homebrew安装MySQL 5.7,但是出现以下错误:

[ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Operation not permitted [ERROR] Aborting [错误]无法打开文件'/var/log/mysql/error.log'进行错误记录:不允许的操作[错误]中止

I have tried to create the file myself so Homebrew doesn't need to create it, but it still complains. 我尝试自己创建文件,因此Homebrew不需要创建它,但仍然会抱怨。 /var/log has this in it /var/log有这个

drwxrwxrwx 3 _mysql _mysql 96 20 Aug 21:25 mysql

and inside /var/log/mysql I have this: /var/log/mysql我有这个:

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

(I manually set them to 777 and owned by mysql:mysql ) (我将它们手动设置为777并由mysql:mysql拥有)

This is the full output: 这是完整的输出:

$ 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

from the output of brew install, it looks like it was installed. 从brew install的输出中,看起来好像已经安装了。 it seems like it's a permission issue on /var/log/mysql/error.log 似乎是/var/log/mysql/error.log上的权限问题

try changing the permission on /var/ folder 尝试更改/ var /文件夹上的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM