Django와 MySQL 사용중 migrate를 하니 발생한 에러
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/4.2/ref/databases/#mysql-sql-mode
https://docs.djangoproject.com/en/4.2/ref/databases/#mysql-sql-mode
DATABASES = {
'default' : {
'ENGINE': 'django.db.backends.mysql',
'NAME': '', # 연동할 mysql db 이름
'USER': '', # db 접속 계정명
'PASSWORD': '', # 해당 계정 비밀번호
'HOST': '',
'PORT': '3306',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
}
}
}
아래의 OPTIONS 부분을 추가해주면 해결~!
https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_sql-mode