Yes, this seems like a common error. But something else is wrong with my environment. I have upgraded from MySQL 5.6 version to 5.7.
I can access mysql5.7 by typing mysql
into the console.
I have updated the DYLD_LIBRARY_PATH to reflect new 5.7 location
git:(parent-child) ✗ echo $DYLD_LIBRARY_PATH
/usr/local/opt/mysql@5.7/lib/:
But the error for reason still says it is trying to load from 5.6 version.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 16, in <module>
import MySQLdb as Database
File "/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/mysql@5.6/lib/libmysqlclient.18.dylib
Referenced from: /Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
Notice the error says it still is trying locate /usr/local/opt/mysql@5.6/lib/libmysqlclient.18.dylib
I have reinstalled almost everything since this error came.
Tried several solutions
Python mysqldb: Library not loaded: libmysqlclient.18.dylib
rails + MySQL on OSX: Library not loaded: libmysqlclient.18.dylib
Nothing seems to change its reference.
How do I make it refer to the newer one which is in /usr/local/opt/mysql@5.7/lib/
Also reinstalled mysqlclient
with pip but still no luck.
Help is welcome. Been struggling since a day.