How to set sql_mode permanently in MySQL?

If you are using Windows Operating System, check your directory my.cnf or my.ini file.

mysql> select @@datadir;

The following is the output

| @@datadir                                   |
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
1 row in set (0.00 sec)

Reach the above location ‘C:\ProgramData\MySQL\MySQL Server 8.0\Data\”. The screenshot is as follows for my.cnf file

Open the my.cnf file and write the sql_mode="TRADITIONAL". The syntax is as follows


After that start your server once again.