How To Disable MySQL Strict Mode

r00t August 5, 2016

How To Disable MySQL Strict Mode

In this tutorial we will show you how to disable MySQL strict mode on your CentOS 7 server. For those of you who didn’t know, Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. A value can be invalid for several reasons.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step turn off or to disable the MySQL strict mode on a CentOS 7 server.

Disable MySQL Strict Mode

Step 1. First let’s start backup MySQL conf.

This ensures you have a way to revert changes if something goes awry,cp -a /usr/my.cnf{,.strict.bak}
cp -a /etc/my.cnf{,.strict.bak} it’s also beneficial because it helps track when and what changes were made:

Step 2. Edit the MySQL configuration files.

Open the file with your favorite command line editor. In this example, we use ‘nano’:

Find the following lines:

If you find a line similar to the above that is setting the sql_mode variable then you will need to replace it with the following line to disable MySQL strict mode:

Finally, Restart MySQL with this command:

Step 3. Confirming Strict SQL Mode Is Disabled.

To verify that the process was completed properly you can run the following:

The output may look similar to the following:

Congratulation’s! You have successfully disable the MySQL strict mode. Thanks for using this tutorial for turn off or to disable the MySQL strict mode on CentOS 7 system. For additional help or useful information, we recommend you to check the official MySQL web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!

Save

Save

Share on Google+0Share on Facebook2Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon32Share on Reddit1Pin on Pinterest2
The Tags:

Leave a Comment