The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Turn off Mysql Strict Mode

Discussion in 'Database Discussions' started by psytanium, Mar 4, 2017.

  1. psytanium

    psytanium Well-Known Member

    Joined:
    Jun 6, 2014
    Messages:
    87
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello,

    After I migrated to a new VPS server, some websites started to show sql errors. I discovered I have to turn off Strict Mode.

    Strick Mode can be turned off only from SSH ? or is it available in cPanel settings ?
    Should I edit the file etc/my.cnf only or /usr/my.cnf too ?
    Should I changed sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES to
    1 - sql_mode =""
    2 - sql_mode =''
    3 - sql_mode=”NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

    ?

    Thank you
     
  2. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    542
    Likes Received:
    39
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Please try with the following steps.

    1) Edit /etc/my.cnf and add
    Code:
    [mysqld]
    sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER"
    2)verified that the mode was previously set
    Code:
    root@000 [~]# mysql -e 'select @@GLOBAL.sql_mode;'
    +-------------------+
    | @@GLOBAL.sql_mode |
    +-------------------+
    |                   |
    +-------------------+
    3) Restart MySQL
    Code:
    root@000[~]# /scripts/restartsrv mysql
    Waiting for mysql to restart...............finished.
    4) Check MySQL
    Code:
    root@000 [~]# mysql -e 'select @@GLOBAL.sql_mode;'
    +-------------------------------------------------------------------------------------------------------------------------------+
    | @@GLOBAL.sql_mode                                                                                                             |
    +-------------------------------------------------------------------------------------------------------------------------------+
    | STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER |
    +-------------------------------------------------------------------------------------------------------------------------------+
    root@000 [~]# 
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You may also want to verify that /usr/my.cnf does not exist on the system, as it will overwrite your /etc/my.cnf file settings. If it does exist, try disabling this file and restarting MySQL:

    Code:
    mv /usr/my.cnf /usr/my.cnf.backup1
    /scripts/restartsrv_mysql
    Thank you.
     
Loading...

Share This Page