MySQL Error Code: 1175. safe update mode update a table without a WHERE

Dung Do Tien Nov 08 2021 134

Hello Guys,

I have a MySQL server and I have created a impression table.  I want to update the value of numberofvisit column to 0:

update impresssion set numerofvisit = 0

I ran the above command and I got an exception Error Code: 1175.  safe update mode updates a table without a WHERE.

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. 
To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

Error Code: 1175.  safe update mode update a table without a WHERE

My table has 12k records. I don't know why it's not allowing me to update it.

Thanks for any suggestions.

Have 1 answer(s) found.
  • M

    MRIDUAVA মৃদুআভা Nov 08 2021

    You can use the command below to help change the setting default in the MySQL database: 

    Like this:

    -- disable safe update mode
    SET SQL_SAFE_UPDATES=0;
    -- execute update statement
    UPDATE table SET column='value';
    -- enable safe update mode
    SET SQL_SAFE_UPDATES=1;

    FOR an example:

    -- disable safe update mode
    SET SQL_SAFE_UPDATES=0;
    -- execute update statement
    UPDATE impresssion SET numerofvisit = 0
    -- enable safe update mode
    SET SQL_SAFE_UPDATES=1;

    I hope it works for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close