メインコンテンツに移動

メインナビゲーション

  • ホーム
  • サイトマップ
  • ビデオ
  • ご連絡

パンくず

  • ホーム
  • MySQLのタイムアウトエラー(#1205 - Lock wait timeout exceeded)の確認及び対処

MySQLのタイムアウトエラー(#1205 - Lock wait timeout exceeded)の確認及び対処

mysql
development
mysql

MySQLエラー:#1205 - Lock wait timeout exceeded; try restarting transaction mysql

  • MySQLのあるテーブルにデータ移行(insert)時にエラーが発生しました
    #1205 - Lock wait timeout exceeded; try restarting transaction mysql

    MySQLのタイムアウト、データロックエラー

    • エラー後に「try restarting transaction」で、MySQLがデータ追加プロセスを再起動したようです
    • データ移行SQL文(非常に単純なテーブル間のデータ移動)
      insert into drills_ch_sentence_temp select * from drills_ch_sentence

原因:不明(おそらくデータ量が多い)

  • はっきりした理由は分かりません
  • おそらくデータ量が多い、テーブル作成時に主キー、ユニックキー、fulltextインデックスが作成したため、データ追加時にpcの負荷が高いかもしれないです

チェック/対処:MySQLのプロセス確認

  • エラー発生後に、MySQLサーバー上で「 show processlist; 」プロセスを確認しました
    
    +-----+------+-----------------+------------+---------+------+--------------+----------------------------------------------------------------------+----------+
    | Id  | User | Host            | db         | Command | Time | State        | Info                                                                 | Progress |
    +-----+------+-----------------+------------+---------+------+--------------+----------------------------------------------------------------------+----------+
    | 356 | pma  | localhost:64231 | NULL       | Sleep   |  261 |              | NULL                                                                 |    0.000 |
    | 357 | root | localhost:64232 | 2drills-d7 | Query   |  261 | Sending data | insert into drills_ch_sentence_temp select * from drills_ch_sentence |    0.000 |
    | 360 | root | localhost:64996 | 2drills-d7 | Query   |    0 | init         | show processlist                                                     |    0.00 |
    +-----+------+-----------------+------------+---------+------+--------------+----------------------------------------------------------------------+----------+
    

    MySQLのプロセス(processlist)確認
  • プロセスの状態(status):sending data
  • 稼働状態になっているため、そのまま放置しました
    • しばらく経ったら、正常にデータ移行が完了
ホーム

古松

検索

Article Category

  • apache(7)
  • css(19)
  • drupal(295)
  • Electron(4)
  • html(34)
  • javascript(27)
  • laravel(4)
  • linux(5)
  • macOS(2)
  • mysql(13)
  • php(19)
  • python(4)
  • SEO(12)
  • video(72)
  • Visual Studio Code(4)
  • windows(13)
  • wordpress(32)