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/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
. For example, if using nano:
bash
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
- Locate the
[mysqld]
section and look for thesql_mode
line. If it’s not present, add it below the[mysqld]
line. Modify thesql_mode
line to removeSTRICT_TRANS_TABLES
:
ini
[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
, thenY
, and finallyEnter
to save and exit. - Restart the MySQL server for the changes to take effect:
bash
sudo systemctl restart mysql
- Verify that the
STRICT_TRANS_TABLES
mode is disabled by running the following command:
bash
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.
Now the STRICT_TRANS_TABLES
SQL mode should be disabled.