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

北慕城南 提交于 2019-12-02 17:05:36

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.

Mihai

If you want to do this from the cli, try this, it worked for me:

$ mysqldump old_DB | mysql --init-command="SET SQL_LOG_BIN = 0;" new_DB

Possible that the "init-command" param was added in a newer MySQL version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!