43

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?

Thanks, Sean

3 Answers 3

79
SHOW VARIABLES LIKE 'log_bin';
Sign up to request clarification or add additional context in comments.

Comments

16

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'

1 Comment

unlike the accepted answer this answer requires privileges; otherwise you will get an error like ERROR 1227 (42000) at line 1: Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation. Furthermore, even if you have privs, the result may be an error, which will cause you extra work if you are doing this in a script or program. ERROR 1381 (HY000) at line 1: You are not using binary logging
6
SELECT * from information_schema.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'LOG_BIN';

or

SELECT @@log_bin;

2 Comments

The second statement in this answer is the most useful of anything posted here because it returns a truthy/falsey value (ie 1,0) instead of a string ('ON','OFF').
ERROR 1109 (42S02): Unknown table 'GLOBAL_VARIABLES' in information_schema

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.