How do i run a query in MYSQL without writing it to the binary log

前端 未结 2 1119
暖寄归人
暖寄归人 2021-01-30 21:59

I want to run an import of a large file into MySQL. However, I don\'t want it written to the binary log, because the import will take a long time, and cause the slaves to fall

2条回答
  •  梦毁少年i
    2021-01-30 22:20

    You can use the sql-log-bin session variable to turn off logging for the current session. Just simply enter:

    SET sql_log_bin = 0;
    

    and all queries on your current session will not be sent to the binary log. If you want to turn binary logging back on, run:

    SET sql_log_bin = 1;
    

    This is only for the currently running session you are in. All other queries from all other connections will still continued to be logged. Also, you must have SUPER privileges for this to work.

提交回复
热议问题