I have a table in MySQL created using:
CREATE TABLE cats (
cat_id INT AUTO_INCREMENT,
name VARCHAR(100),
breed VARCHAR(100),
age INT,
PRIMARY KEY (cat_id)
);
I have inserted below values into this table:
INSERT INTO cats(name, breed, age)
VALUES ('Ringo', 'Tabby', 4),
('Cindy', 'Maine Coon', 10),
('Dumbledore', 'Maine Coon', 11),
('Egg', 'Persian', 4),
('Misty', 'Tabby', 13),
('George Michael', 'Ragdoll', 9),
('Jackson', 'Sphynx', 7);
But when I try to update the table using:
UPDATE cats SET breed='Shorthair' WHERE breed='Tabby';
I'm getting the error
Error Code: 1175
You are using safe update mode
I am expecting the table to be updated according to the query.
That error means that your MySQL session has a
safe-updates
option enabled.You have two ways to solve this:
The
<id>
is the primary key you had set for the table.safe-updates
option by:You can then execute your original
UPDATE
query.Also, please make sure you enable it back after your use, by: