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

sql_mode="TRADITIONAL".

After that start your server once again.

Updated on: 30-Jul-2019

716 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements