Can we track only executed DDL statements in MySQL but not DML statements. I dont want to use either binlog/general log to enable. I just wanted to track only DDL statements.

I had gone through the below link in MySQL Site. But in the site, it is not mentioned how to enable/disable this log.


I added below line in my.cnf and restarted MySQL service. MySQL got restarted successfully, but I could not find any DDL log in the below path.


Is this feature released or will it be released in future.

1 Answer 1


Please look at the MySQL Documentation again

A record of metadata operations such as those just described are written to the file ddl_log.log, in the MySQL data directory. This is a binary file; it is not intended to be human-readable, and you should not attempt to modify it in any way.

ddl_log.log is not created until it is actually needed for recording metadata statements, so it is possible for this file not to be present on a MySQL server that is functioning in a completely normal manner.

There are no user-configurable server options or variables associated with this file.

I looked at the Server Variables and there is no ddl_log option.

You can count ALTER TABLE commands from status variables (Com_alter_table).


If you are using MySQL 5.6 and should you decide to bite the bullet and use mysqlbinlog and parse the output, you may need to setup mysqlbinlog on an external server, redirecting output to your own log file for DDLs. You will also have to use stop-never. here is what the MySQL Documentation says on stop-never:

This option is used with --read-from-remote-server. It tells mysqlbinlog to remain connected to the server. Otherwise mysqlbinlog exits when the last log file has been transferred from the server. stop-never implies --to-last-log, so only the first log file to transfer need be named on the command line.

--stop-never is commonly used with --raw to make a live binary log backup, but also can be used without --raw to maintain a continuous text display of log events as the server generates them.

This option was added in MySQL 5.6.0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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