Forums

Changing sql-mode in my.cnf - no effect

I created a virtual environment, installed Django 4, set up my web app to make sure D4 was working. All good.<br> Then I created a new database and used D4 to "migrate" into this new database. (It told me D4 built-in apps require a database to function)<br> The migration was a success, however, during that migration it gave me a warning about the database not being set to STRICT mode.<br> I read up on it and I ended up trying to update the my.cnf file found in my root directory with:

[mysqld]
sql-mode = "STRICT_ALL_TABLES"

I save this file and open a new console under the new database. Then I enter:

select @@Global.sql_mode;

It returns:

+------------------------+
| @@Global.sql_mode      |
+------------------------+
| NO_ENGINE_SUBSTITUTION |
+------------------------+
1 row in set (0.00 sec)

I have yet to continue with my D4 tutorial but I just want to make sure I've successfully added the STRICT mode before I continue.<br> I read that I have to restart the mySQL server in order for the my.cnf file to take effect. If I'm on the right track, how would I go about doing that? If not, am I checking this correctly? How do I know STRICT mode has taken effect?<br>

Thanks.

You can set sql_mode in you DATABASE OPTIONS setting see https://docs.djangoproject.com/en/4.0/ref/databases/#setting-sql-mode