MySQL 如何通过sql命令知道mysql二进制日志是否启用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6956106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to know if mysql binary log is enable through sql command?
提问by Sean Nguyen
I have a mysql instance running and I want to know if binary log is enable for that instance without logging into the machine and check my.cnf file. Is there a way to do that?
我有一个 mysql 实例正在运行,我想知道是否为该实例启用了二进制日志,而无需登录机器并检查 my.cnf 文件。有没有办法做到这一点?
Thanks, Sean
谢谢,肖恩
回答by wonk0
SHOW VARIABLES LIKE 'log_bin';
回答by kta
After login Execute the following command
登录后执行以下命令
SHOW BINARY LOGS
If there is no binary logs then you will get a message similar to 'You are not using binary logging'
如果没有二进制日志,您将收到类似于“您没有使用二进制日志”的消息
回答by Devart
SELECT * from information_schema.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'LOG_BIN';
or
或者
SELECT @@log_bin;