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>

 

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