first install mysql, and then modify Django’s setting. Py
The original:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR/'db.sqlite3',
}
}
Amend to read:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Database engine
'NAME': 'database name',
'USER': 'User name',
'PASSWORD': 'password',
'HOST': '127.0.0.1', # ip of the host where mysql service is located
'PORT': '3306', # mysql service port
}
}
add environment variables (address NameError: name ‘_mysql’ is not defined)
Add to the environment variable:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
Then it’s done
Read More:
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- [Solved] Windows MYSQL Error: django.db.utils.OperationalError: (2026, ‘SSL connection error: unknown error number‘)
- [Solved] MYSQL Error: ERROR! MySQL server PID file could not be found!
- C# Connect MYSQL Error: MySql.Data.MySqlClient.MySqlException:“SSL Connection error.”
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- Centos7 Initialize mysql Error: Could not open file ‘/usr/local/mysql/log/mysqld.log‘ for error logging: Per
- [Solved] CentOS installs MySQL and starts MySQL with error 2002 (HY000)
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- MySQL Install Error: MySQL error 1042: Unable to connect to any of the specified MySQL hosts
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- mac brew install mysql ‘/tmp/mysql.sock’ (2) [How to Solve]