mac mysql nginx dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

今天突然启动 mysql 报错

$ mysql -uroot -p
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/bin/mysql
  Reason: image not found
[1]    97293 abort      mysql -uroot -p

有时启动其他软件也会报这个错误,比如 nginx

原因:

这个是由于 openssl 的版本影响到的。

因为 brew install python3安装python3后导致openssl升级到1.1,但mysqldump还是依赖的1.0.0,从而导致mysqldump时提示

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

再次把版本降回来即可。

解决办法:

使用 brew switch openssl 1.0.2s

如果执行命令后报这个错

$ brew switch openssl 1.0.2s
Error: openssl does not have a version "1.0.2s" in the Cellar.
openssl's installed versions: 1.0.2r

可以按照提示使用 1.0.2m,1.0.2n 或者 1.0.2r解决下,根据提示来操作就好

结果:

安装完成即可连接 mysql 了

$ brew switch openssl 1.0.2r
Cleaning /usr/local/Cellar/openssl/1.0.2r
Opt link created for /usr/local/Cellar/openssl/1.0.2r
$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章