Opened 6 years ago

Closed 6 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)

comment:1 in reply to:  description Changed 6 years ago by Robert Rollins

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

comment:2 Changed 6 years ago by Robert Rollins

Component: UncategorizedDocumentation
Type: UncategorizedBug
Version: 1.111.10

comment:3 Changed 6 years ago by Tim Graham

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

comment:4 Changed 6 years ago by Robert Rollins

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 Changed 6 years ago by Simon Charette

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

comment:6 Changed 6 years ago by Robert Rollins

My project uses mysqlclient 1.3.9.

comment:7 Changed 6 years ago by Tim Graham

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 Changed 6 years ago by Robert Rollins

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 Changed 6 years ago by Tim Graham

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