##################################
查看ddl语句的日志,需要开启:
mysql> show global variables like '%innodb_print_ddl_logs%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_print_ddl_logs | OFF |
+-----------------------+-------+
1 row in set, 1 warning (0.19 sec)
mysql> set global innodb_print_ddl_logs=1;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like '%log_error_verbosity%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| log_error_verbosity | 2 |
+---------------------+-------+
1 row in set, 1 warning (0.00 sec)
mysql> set global log_error_verbosity=3;
Query OK, 0 rows affected (0.00 sec)
mysql>
另外就是我们可以通过设置
innodb_print_ddl_logs=1
和
log_error_verbosity=3
在 MySQL 的 系统日志里面查看 DDL log。