Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running MySQL 5.1.47 on CentOS. How do I check if binary logging for InnoDB is active? How do I enable binary logging if they are not enabled? Just run?
mysqld --log-bin

share|improve this question
up vote 2 down vote accepted

Check if binary logging is active:

mysql> show variables like '%bin%';
| Variable_name                   | Value                |
| binlog_cache_size               | 32768                |
| binlog_format                   | STATEMENT            |
| innodb_locks_unsafe_for_binlog  | OFF                  |
| log_bin                         | ON                   |
| log_bin_trust_function_creators | OFF                  |
| log_bin_trust_routine_creators  | OFF                  |
| max_binlog_cache_size           | 18446744073709547520 |
| max_binlog_size                 | 419430400            |
| sql_log_bin                     | ON                   |
| sync_binlog                     | 0                    |
10 rows in set (0.00 sec)

The key part here is log_bin ON but the other results can be interesting / important too.

You should also see a bunch of files in your datadir named hostname-bin.00001. You can use mysqlbinlog <filename> to see the queries in the binary logs.

To turn it on, mysql> SET GLOBAL log_bin = ON;

You will also want to edit your my.cnf so that log_bin = ON the next time you restart MySQL.

share|improve this answer
Brilliant, thanks. Exactly what I needed! – Adrien Hingert Mar 7 '12 at 1:09
It is also a good practice to set log-bin = /path/to/bin-log, (my-cnf), and use another disk partition, this way, if you forget to clean up the binary logs, you mysqld will continue running without major problems. – CarlosH Mar 7 '12 at 3:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.