1 개요[ | ]
- django mysql-sql-mode warning
- python manage.py migrate 작업 수행 시 발생
2 문제 상황[ | ]
- python manage.py migrate 실행 시 경고 발생
Console
Copy
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
3 해결[ | ]
settings.py
Bash
Copy
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'xxxx',
'USER': 'xxxx',
'PASSWORD': 'xxxx',
'HOST': 'xxxx',
'PORT': '',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
# 'sql_mode': 'traditional',
}
}
}
- 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" 혹은 # 'sql_mode': 'traditional' 를 추가하면 됨
4 같이 보기[ | ]
5 참고[ | ]
편집자 John Jeong Jmnote
로그인하시면 댓글을 쓸 수 있습니다.