TIMESTAMP with implicit DEFAULT value is deprecated

When setup MySQL using Docker, I got this warning messages.

2022-03-01 16:32:02+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started.
2022-03-01 16:32:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-03-01 16:32:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started.
2022-03-01 16:32:03+00:00 [Note] [Entrypoint]: Initializing database files
2022-03-01T16:32:03.363347Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-03-01T16:32:03.368810Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2022-03-01T16:32:03.368894Z 0 [ERROR] Aborting

As suggested in the logs above, the simple solution is you have to add explicit_defaults_for_timestamp=true into /etc/mysql/mysql.conf.d/mysqld.cnf on the [mysqld] section. Then restart your MySQL to take effect.
2022-03-01 19:21:03+00:00 [Note] [Entrypoint]: Starting temporary server
2022-03-01 19:21:03+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-03-01T19:21:04.098887Z 0 [Note] mysqld (mysqld 5.7.37) starting as process 73 ...
2022-03-01T19:21:04.122680Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-03-01T19:21:04.122817Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-03-01T19:21:04.122872Z 0 [Note] InnoDB: Uses event mutexes
2022-03-01T19:21:04.122885Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-03-01T19:21:04.122891Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-03-01T19:21:04.122897Z 0 [Note] InnoDB: Using Linux native AIO
2022-03-01T19:21:04.123252Z 0 [Note] InnoDB: Number of pools: 1
2022-03-01T19:21:04.123396Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-03-01T19:21:04.126063Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-03-01T19:21:04.141636Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-03-01T19:21:04.144961Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().


Leave a Reply

Please leave a comment and do not give a spam! Comments that smells of spam will be deleted without prior notice