MySQL logs DDL statements to a DDL log but it's not human-readable and the server daemon deletes it on every restart. That implies two longshot possibilities for DDL logging ... (i) modify server source to add a persisting human-readable form of the DDL of the log, (ii) make a feature request for that at https://bugs.mysql.com/ ... and two more plausible alternatives ... (iii) fetch DDL statements from the general log (https://dev.mysql.com/doc/refman/8.0/en/query-log.html) (iv) fetch DDL statements from the binary log. From https://dba.stackexchange.com/questions/91185/how-to-track-only-ddl-statements-executed-in-mysql: If you are using MySQL 5.6 (or later) 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 Last updated 18 Apr 2024 |
![]() |