Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    Default Trying to disable MySQL strict mode

    I need to turn off MySQL strict mode for a couple of applications to work properly and have been unsuccessful. System is as follows:

    WHM 11.28.52
    Centos 5.5
    MySQL 5.1.51

    I have tried editing etc/my.cnf

    The original is:
    Code:
    [mysqld]
    set-variable = max_connections=500
    safe-show-database
    local-infile=0
    I have tried adding each of the below individually and restarting MySQL after each

    Code:
    sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    sql-mode=""
    sql-mode="TRADITIONAL"
    Any ideas on what I am doing wrong?

  2. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: Trying to disable MySQL strict mode

    Hi Doug,

    I was able to modify the /etc/my.cnf with the desired results.

    My Scenario:
    1)added to /etc/my.cnf

    Code:
    [mysqld]
    sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER"
    2)verified that the mode was previously set
    Code:
    root@054 [~]# mysql -e 'select @@GLOBAL.sql_mode;'
    +-------------------+
    | @@GLOBAL.sql_mode |
    +-------------------+
    |                   | 
    +-------------------+
    3) restart mysql
    Code:
    root@054 [~]# /scripts/restartsrv mysql
    Waiting for mysql to restart...............finished.
    
    mysqld_safe (/bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/054.cpanel.test.pid) running as root with PID 26370
    mysqld (/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/054.cpanel.test.pid --skip-external-locking) running as mysql with PID 26394
    
    mysql started ok
    4) check mysql
    Code:
    root@054 [~]# 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@054 [~]#
    The only thing that stands out as a possible oversight is to make sure that you added the variable within the [mysqld] section of the my.cnf

    If your problem persists, you may want to open a ticket with cPanel Technical Support.

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  3. #3
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: Trying to disable MySQL strict mode

    Oh also, make sure you use "sql_mode" and not "sql-mode" for the variable key name in /etc/my.cnf.
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    Default Re: Trying to disable MySQL strict mode

    The "_" was the major problem I think.

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    1
    cPanel/Enkompass Access Level

    Website Owner

    Default Re: Trying to disable MySQL strict mode

    This can be done in two ways...

    1- Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".

    Find:

    Code:
    # Set the SQL mode to strict sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    Replace with:

    Code:
    # Set the SQL mode to strict sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    Or

    2- You can run an SQL query within your database management tool, such as phpMyAdmin:

    Code:
    SET @@global.sql_mode= '';

Similar Threads & Tags
Similar threads

  1. Forcing mySQL into 'TRADITIONAL' (strict) mode?
    By jez9999 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-17-2006, 04:52 PM
  2. disable firewall from rescue mode
    By sinahost in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-09-2006, 09:55 PM
  3. enable/disable demo mode?
    By chadi in forum cPanel and WHM Discussions
    Replies: 23
    Last Post: 10-07-2004, 08:22 AM
  4. Disable or Enable Demo Mode
    By machine in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-08-2003, 07:38 AM
  5. How to disable php safe mode?
    By SkateYeah in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-24-2003, 06:04 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube