To disable the
STRICT_TRANS_TABLES SQL mode on your server, you can follow these steps:
- Access your server via SSH using your preferred terminal or SSH client.
- Open the MySQL configuration file with a text editor, such as nano or vim. The file is typically located at
/etc/mysql/mysql.conf.d/mysqld.cnf. For example, if using nano:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
- Locate the
[mysqld]section and look for the
sql_modeline. If it’s not present, add it below the
[mysqld]line. Modify the
sql_modeline to remove
[mysqld] sql_mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Make sure that the
STRICT_TRANS_TABLES option is removed from the list of modes. If you want to keep other modes, separate them with commas.
- Save the file and exit the text editor. For nano, press
Ctrl + X, then
Y, and finally
Enterto save and exit.
- Restart the MySQL server for the changes to take effect:
sudo systemctl restart mysql
- Verify that the
STRICT_TRANS_TABLESmode is disabled by running the following command:
mysql -u root -p -e "SELECT @@GLOBAL.sql_mode;"
Enter your MySQL root password when prompted. Check the output and ensure
STRICT_TRANS_TABLES is no longer listed.
STRICT_TRANS_TABLES SQL mode should be disabled.