Get Full MySQL Query String on Insert or Update

后端 未结 8 1026
旧巷少年郎
旧巷少年郎 2020-12-13 10:16

Need help with MySQL as it\'s not really my forte. So any help is appreciated.

I have issues on my site where UPDATE or INSERT were done wi

8条回答
  •  旧巷少年郎
    2020-12-13 10:52

    You probably want to turn on binary logging so you can look at every update (note: not every query). You just need to add the --log-bin option, then look through the resulting log using mysqlbinlog. If necessary, you can start a copy of your database from a backup, start in the log at the position of the backup (saved in the backup using something like the --master-data option to mysqldump), and run the updates one at a time until you get a bad row. You then know which update is the culprit. You can script that last part and/or use binary search on the length of the log to make it go faster.

提交回复
热议问题