mysql> show variables like 'explicit_defaults_for_timestamp'; +---------------------------------+-------+ | Variable_name | Value | +---------------------------------+-------+ | explicit_defaults_for_timestamp | OFF | +---------------------------------+-------+ 1 row in set (0.00 sec)
mysql> set @@global.explicit_defaults_for_timestamp=on; Query OK, 0 rows affected (0.00 sec)
mysql> set @@session.explicit_defaults_for_timestamp=on; Query OK, 0 rows affected (0.00 sec) vi /etc/my.cnf explicit_defaults_for_timestamp=true
[client] default-character-set = utf8mb4
[mysql] default-character-set = utf8mb4
[mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4' explicit_defaults_for_timestamp=true [root@localhost etc]# (责任编辑:IT) |