`brew link mysql` gives "Error: Could not symlink bin/my_print_defaults"

2.6k Views Asked by At

brew install mysql-connector-c

gave:

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

  mysql: because both install MySQL client libraries

Please `brew unlink mysql` before continuing.

So:

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

brew install mysql-connector-c

worked fine. But now brew link mysql gives:

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

Confused. Unlink? Overwrite?

1

There are 1 best solutions below

0
Naruto On

I got stuck in the same situation. I solved the problem as follows.

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