NameError: name '_mysql' is not defined after setting change to mysql
this worked for me:
add this to PATH:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$PATH"
This did the job for me! Just install libmysqlclient-dev (sudo apt-get install libmysqlclient-dev
for Ubuntu). Sometimes, the lib files simply are missing even if you just installed mysql. :)
So, I'm answering my own question. Since my blog has database, I gave it a shot to make another project without db, start fresh.
What I noticed was there's a problem importing MySQLdb
module(sub module of mysqlclient) with this traceback: Library not loaded: @rpath/libmysqlclient.21.dylib
.
For browsing a few hours I realised that for some reason Mac security setting keeps this from being imported properly.
On mysqlclient
library github I found one issue reporting the same as mine. It suggests I run cp -r /usr/local/mysql/lib/* /usr/local/lib/
. After this I set settings.py
for django.db.backends.mysql
, ran python manage.py migrate
and it worked. So for empty database, this could be a solution. Still struggling with database one though.
I use
- MacOS Catalina 10.15.6
- pyenv