MySQL Strict Mode is used to prevent users from configuring any third-party websites or software for security purposes. It’s easy to disable MySQL Strict Mode on your Server using the following methods:
- Disable MySQL Strict Mode from my.cnf File
- Disable MySQL Strict Mode from SQL
1: Disable Strict Mode using my.cnf File
Follow the below steps to inactive the MySQL Strict Mode on the Server:
- First of all, log in to SSH using root credentials.
- Navigate to the /etc directory and open my.cnf file using the vi or nano command.
- Find the sql_mode = “” line and type the below command inside the double quotes ( ” ” ).
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Note: If sql_mode = “” line isn’t visible, you can create one inside the [mysqld] section (if there is no [mysqld] section, create it).
- Press Esc from your keyboard and type :wq! command to save and close the editor window.
- Restart MySQL Server using the service mysql restart command, and you’re done.
2: Disable Strict Mode via SQL
Follow the below steps to turn off the strict mode using the SQL command from SSH.
- Open SSH, and log into your MySQL server.
- Type the below command to disable strict mode on your server.
mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
- To verify the current MySQL Mode, use the below command.
mysql -u root -p -e
"SELECT @@GLOBAL.sql_mode;"
- Enter your MySQL password to continue, and you’re done.
That’s it.
This is how you can easily disable strict mode using two different methods. I hope this helps you. If not, you can hit the comment section or simply reach out to us on Facebook or Twitter. Other than this, if you don’t want to face these kinds of messy issues, and looking further for a Web Hosting Provider that can reduce your burden of technical work, Redserverhost could be your first choice.