How to Disable MySQL Strict Mode on Server

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:

  1. Disable MySQL Strict Mode from my.cnf File
  2. 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:

  1. First of all, log in to SSH using root credentials.
  2. Navigate to the /etc directory and open my.cnf file using the vi or nano command.

    Navigate to my.cnf file
    Navigate to my.cnf file
  3. 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).

  4. Press Esc from your keyboard and type :wq! command to save and close the editor window.

    Save File in Linux
    Save File in Linux
  5. Restart MySQL Server using the service mysql restart command, and you’re done.
    Mysql service restart
    Mysql service restart

     

2: Disable Strict Mode via SQL

Follow the below steps to turn off the strict mode using the SQL command from SSH.

  1. Open SSH, and log into your MySQL server.
  2. Type the below command to disable strict mode on your server.
    mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
  3. To verify the current MySQL Mode, use the below command.
    mysql -u root -p -e "SELECT @@GLOBAL.sql_mode;"
  4. 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 TwitterOther 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.

Scroll to Top