How to turn on/off MySQL strict mode in localhost (xampp)?

后端 未结 11 2122
时光说笑
时光说笑 2020-12-04 07:54

I want to know how to check whether MySQL strict mode is on or off in localhost(xampp).

If on then for what modes and how to off.

If off then how to on.

相关标签:
11条回答
  • 2020-12-04 08:36

    In my case, I need to add:

    sql_mode="STRICT_TRANS_TABLES"
    

    under [mysqld] in the file my.ini located in C:\xampp\mysql\bin.

    0 讨论(0)
  • 2020-12-04 08:38

    on Debian 10 I start mysql from ./opt/lampp/xampp start

    I do strace ./opt/lampp/sbin/mysqld and see that my.cnf is there:

    stat("/opt/lampp/etc/my.cnf", {st_mode=S_IFREG|0644, st_size=5050, ...}) = 0
    openat(AT_FDCWD, "/opt/lampp/etc/my.cnf", O_RDONLY|O_CLOEXEC) = 3
    

    hence, I add sql_mode config to /opt/lampp/etc/my.cnf instead of /etc/mysql/my.cnf

    0 讨论(0)
  • 2020-12-04 08:39

    To Change it permanently in ubuntu do the following

    in the ubuntu command line

    sudo nano /etc/mysql/my.cnf
    

    Then add the following

    [mysqld]
    sql_mode=
    
    0 讨论(0)
  • 2020-12-04 08:39

    You can check the local and global value of it with:

    SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE;
    
    0 讨论(0)
  • 2020-12-04 08:41

    on server console:

    $ mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';" 
    
    0 讨论(0)
提交回复
热议问题