How To Disable MySQL Strict Mode on cPanel Server

How To Disable MySQL Strict Mode on cPanel Server

⚡ Steps to Disable MySQL Strict Mode on cPanel Server


🔹 Step 1: Log in as Root

Log in to your cPanel/WHM server via SSH or open the Terminal from WHM.


🔹 Step 2: Edit MySQL Configuration File

Open the /etc/my.cnf file using a text editor:

# nano /etc/my.cnf 

🔹 Step 3: Locate sql_mode Setting

Search for the line that defines sql_mode.
It usually looks like this:

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

🔹 Step 4: Remove Strict Mode Values

Delete the strict values (like STRICT_TRANS_TABLES or STRICT_ALL_TABLES) and keep only:

# sql_mode=""

👉 or completely comment out the sql_mode line.


🔹 Step 5: Save the File

In nano, press:

CTRL + OSave CTRL + XExit

🔹 Step 6: Restart MySQL Service

Restart MySQL to apply changes:

# systemctl restart mysql 

or (depending on your system):

# service mysql restart 

For MariaDB:

# systemctl restart mariadb 

✅ At this point, MySQL strict mode is disabled.
You may need to restart applications or websites that rely on the database.

Share

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0