Opened 7 years ago

Closed 7 years ago

#28162 closed Bug (worksforme)

Documented solution to "MySQL Strict Mode is not set" warning doesn't work in MySQL 5.5

Reported by: Robert Rollins Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The Django docs claim that you can get rid of this warning by adding the following to your DATABASES setting:

'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"

This does not work in MySQL 5.5.47. The warning doesn't go away.

However, adding this to DATABASES does get rid of the warning:

'OPTIONS': {
    'sql_mode': 'STRICT_TRANS_TABLES',
}

I found this solution here, but it seems like it really should be in the docs. Unless this doesn't work in newer MySQLs?

Change History (9)

in reply to:  description comment:1 by Robert Rollins, 7 years ago

Forgot to mention that I'm having this problem in Django 1.10.7.

comment:2 by Robert Rollins, 7 years ago

Component: UncategorizedDocumentation
Type: UncategorizedBug
Version: 1.111.10

comment:3 by Tim Graham, 7 years ago

I'm not able to reproduce that problem with MySQL 5.5.55. Can you explain why the command wouldn't work?

comment:4 by Robert Rollins, 7 years ago

When I run manage.py migrate, I still get the big yellow warning when using init_command. The warning does not trigger when using OPTIONS.

comment:5 by Simon Charette, 7 years ago

Robert, which Python library are you using to connect to MySQL?

comment:6 by Robert Rollins, 7 years ago

My project uses mysqlclient 1.3.9.

comment:7 by Tim Graham, 7 years ago

I'm also testing with mysqlclient and the warning goes away for me when using the 'init_command' version. When I said "Can you explain why the command wouldn't work?", I meant: do you know if there's some change in MySQL 5.5.x that fixed a bug or something? Have you tried to reproduce on newer versions of MySQL?

comment:8 by Robert Rollins, 7 years ago

No, I have no idea why this is happening, and have not tested it on any different versions of MySQL. I'm just reporting the behavior that I'm seeing in my current development environment.

comment:9 by Tim Graham, 7 years ago

Easy pickings: unset
Resolution: worksforme
Status: newclosed

Since I can't reproduce the problem, I guess we'll close the ticket until someone can explain what's going on so we know what documentation change to make.

Note: See TracTickets for help on using tickets.
Back to Top