Disabling Strict Database Mode in MySQL 5.x

5,177 0

Today, while helping a user set up WHMCS (an IDC management system), I encountered a database-related issue: WHMCS 6.x cannot run in strict database mode, so this database strict mode needs to be disabled.

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

Method One

Modify my.cnf

Set the startup parameters to change the default sql_mode to a more permissive mode.

Use the command:

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

Then restart the MySQL server:

Bash
service mysqld restart

Method Two

Modify mysqld

Use the command:

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

Then restart the MySQL server:

Bash
service mysqld restart

Note

MySQL 5.5 should use the second method.

Comments

(0)

No comments yet. Start the conversation.

Leave a comment