How to set global sql_mode in mysql?

Linode Staff

I am having issues when the SQL server restarts.

How do I configure MySQL so that that when the sql server restarts, the only SQL MODE that will be restored are "ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"?

1 Reply

As far as I know, you will need to set this mode within /etc/my.cnf in the [mysqld] section of the file:


This should cause your mode to persist even when the server is restarted. You can do this with any of the available modes as well.

If you just run:


It will not save the mode globally, but just within that session.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct