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

后端 未结 11 2136
时光说笑
时光说笑 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:20

    For ubuntu :

    • Once you are connected to your VPS via SSH, please try connecting to your mysql with "root"

    user: mysql -u root -p

    • Enter "root" user password and you will be in the mysql environment (mysql>), then simply check what is sql_mode, with the following command:

      SHOW VARIABLES LIKE 'sql_mode';

    Basically, you will see the table as your result, if the table has a value of STRICT_TRANS_TABLES, it means that this option is enabled, so you need to remove the value from this table with the following command:

    set global sql_mode='';
    

    This will set your table's value to empty and disable this setting. Like this:

     +---------------+-------+
     | Variable_name | Value |
     +---------------+-------+
     | sql_mode      |       |
     +---------------+-------+
    

    Please make sure to perform these commands within the MySQL environment and not simply via SSH. I think this moment was missed in the article provided below and the author assumes that the reader understands it intuitively.

提交回复
热议问题