LoginSignup
3

More than 3 years have passed since last update.

MySQL Workbenchでupdate文を実行したら「Error Code: 1175」のエラーが出た

Last updated at Posted at 2020-01-17

はじめに

MySQL Workbenchにて、update文を実行したら、以下のエラーが出たので対処法を残します

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.   0.0017 sec

環境

MySQL Workbench 8.0

結論

「Safe Updates」の設定をオフにすることで、エラーはでなくなります

設定方法

  • MySQL Workbenchを起動して、メニューを以下の順で選択します

    • 「MySQLWorkbench」→「Preferences」
  • 左のメニューの「SQL Editor」を選択して、一番下までスクロールすると「Safe Updates」の設定があるので、チェックをはずして、「OK」ボタンをクリックします(以下イメージ参照)

image.jpg

  • データベースに再接続すれば、設定が有効になり、update文が実行できます

まとめ

設定を変更することで、update文が実行できるようになりますが、オフにすることでwhere句なしで更新できてしまうので、本番環境にアクセスするときは気をつけましょう
設定をオンにしておくとよいかと思います

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3