MySQL???????
???????????? ???????[ 2017/4/5 11:20:39 ] ????????????? MySQL
????????bin log?? ?????????????????
?????????????????????err log?? ????3????????????????????????????
???????MySQL????????????????? ?????????????????????????????????????bin log?????????????????Щ??????????????????????Щ??????????????bin log?е?????????????
????????? ???log???????MySQL????????????. ???磬 ??????????????????MySQL?У? ?????ò????????????????????
???????????. ????? log??????????????????. ?????????????? ????????????????? ???????????洢???????????
???????????????洢??仹???.
?????????????(bin log)
???????update log?? ???????????????仯???. ???bin log??????MySQL????????????Щ???.
?????????????bin log
????# my.cnf
????[mysqld]
????log-bin [=DIR [filename]]
????DIR: ???bin log??洢·??
????filename: ???bin log????????? ??????filename.number?? ????filename.000001?? filename.000002??. ???????MySQL???? ????????????μ?bin log???. ??Щbin log?????'number'???????. ????????????????? ??????????????filename.index?????.
???????????д洢????bin log??????嵥.
?????????????DIR?? filename?? bin log?????洢???????????????£? ??????????hostname-bin.number?? ????hostname???????.
????bin log????????????????ò???????????????. ???????????????????????? ???????????????????bin log???????
?????????. ????????????????????С???. ????????????????????????.
??????bin log
????mysqlbinlog filename.number
???????bin log??????????
????mysqlbinlog filename.number | mysql -u root -p
??????? ???(number)С???????????
????mysqlbinlog mylog.00001 | mysql -u root -p
????mysqlbinlog mylog.00002 | mysql -u root -p
????mysqlbinlog mylog.00003 | mysql -u root -p
????mysqlbinlog mylog.00004 | mysql -u root -p
?????????????bin log????
????SET SQL_LOG_BIN=0; # ???
????SET SQL_LOG_BIN=1; # ????????
???????????(error log)
????err log?????????? ????????????. ???洢·??????????????????. ?????????hostname.err.
?????洢·????????? log-error?????????
????# my.cnf
????[mysqld]
????log-error=DIR [/ filename]
??????ò?????
??????ò??????????????????????в????? ???????????MySQL???? ??????????????.
?????????????hostname.log?? ???洢·??????????????????.
???????????£? ??ò??????????????. ??????????淽????????
????# my.cnf
????[mysqld]
????log [=DIR [filename]]
????????????
?????????????????????????????????????????. ????????????? ??????????Щ??????????Ч????? ?????????.
????????????????????洢·?????????????????У? ?????????hostname-slow.log
????# my.cnf
????[mysqld]
????log-slow-queries [=DIR [filename]]
????long_query_time=n
????# ????????n???????????????? n?????????? ?????10s
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11