3

brew install mysql-connector-c

给了:

Error: Cannot install mysql-connector-c because conflicting formulae are installed.

  mysql: because both install MySQL client libraries

Please `brew unlink mysql` before continuing.

所以:

brew unlink mysql
Unlinking /usr/local/Cellar/mysql/5.7.9... 88 symlinks removed

brew install mysql-connector-c

工作正常。但现在brew link mysql给出:

Linking /usr/local/Cellar/mysql/5.7.9... 
Error: Could not symlink bin/my_print_defaults
Target /usr/local/bin/my_print_defaults
is a symlink belonging to mysql-connector-c. You can unlink it:
  brew unlink mysql-connector-c

To force the link and overwrite all conflicting files:
  brew link --overwrite mysql

To list all files that would be deleted:
  brew link --overwrite --dry-run mysql

使困惑。取消链接?覆盖?

4

1 回答 1

2

我陷入了同样的境地。我解决了如下问题。

$ ls /usr/local/Cellar/mysql*
/usr/local/Cellar/mysql:
5.7.19

/usr/local/Cellar/mysql-connector-c:
6.1.11

$ brew unlink mysql
Unlinking /usr/local/Cellar/mysql/5.7.19... 0 symlinks removed

$ brew link --force mysql-connector-c
Warning: Already linked: /usr/local/Cellar/mysql-connector-c/6.1.11
To relink: brew unlink mysql-connector-c && brew link mysql-connector-c

$ brew unlink mysql-connector-c
Unlinking /usr/local/Cellar/mysql-connector-c/6.1.11... 48 symlinks removed

$ brew link mysql-connector-c
Linking /usr/local/Cellar/mysql-connector-c/6.1.11... 48 symlinks created

$ mysql
zsh: command not found: mysql

$ brew unlink mysql-connector-c
Unlinking /usr/local/Cellar/mysql-connector-c/6.1.11... 48 symlinks removed

$ brew link mysql
Linking /usr/local/Cellar/mysql/5.7.19... 93 symlinks created

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor…..
于 2017-11-01T09:19:31.257 回答