Home  >  Q&A  >  body text

How to capture executed mysql errors through shell and report them to the table


The picture above is the statement I executed when inserting into the database. The following is some of the errors output


But I can’t see where these errors occur. Is there any way to make them report to the table

怪我咯怪我咯2735 days ago610

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-18 10:50:19

    Yourfor table in ${DBTables[@]}has already saved the name of the table; you can modify the original script:

    mysql -h ......(省略)
    echo "执行的表名时: $table"  # 输出正在修改的mysql表

    PS:
    Your error should be that you inserted duplicate data into the table, and the related fields of the table happened to be set so that they cannot be repeated, so the error was reported

    reply
    0
  • Cancelreply