Today, while helping a netizen set up WHMCS (an IDC management system), I encountered a database issue: WHMCS 6.x cannot run in database strict mode, so database strict mode must be disabled.

After searching for relevant information, I summarized the following two methods for disabling database strict mode. I tested them with MySQL 5.5; test other versions yourself. If you encounter any problems, please leave a comment in the section below.

Method 1

Modify my.cnf

Set the startup parameters and change the default sql_mode to relaxed mode.

Use the command:

echo "sql-mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" >> /etc/my.cnf

Then restart the MySQL server:

service mysqld restart

Method 2

Modify mysqld

Use the command:

sed -i "s#\"\$\*\"#--sql-mode=\"NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\"#" /etc/init.d/mysqld

Then restart the MySQL server:

service mysqld restart

Note

MySQL 5.5 users should use the second method.