Disabling Database Strict Mode in MySQL 5.x

5,157 0

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:

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

Then restart the MySQL server:

Bash
service mysqld restart

Method 2

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 users should use the second method.

Comments

(0)

No comments yet. Start the conversation.

Leave a comment

© 2026 Carefree. All rights reserved.

Carefree is a personal site about technology and everyday life, documenting web development, backend, and DevOps practices, plus software tools, digital experiences, and thoughts beyond code.