I run Wordpress with MySql 5.7.25.0ubuntu18.04.2
and want to move database to other machine.
When I do it with Database Migration
I run into errors with DATETIME fields, eg
Invalid default value for 'comment_date'. SQL Error: 1067
I figured out, that given DEFAULT value 0000-00-00 00:00:00
don't work anymore. So I tried to change it to 1000-01-01 00:00:00
but this only works for
ALTER TABLE `wordpress`.`wp_links` ALTER `link_updated` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_users` ALTER `user_registered` SET DEFAULT '1000-01-01 00:00:00';
successful without errors.
fine !
But these following ones still doesn't work: same field type, same default value... ?
ALTER TABLE `wordpress`.`wp_comments` ALTER `comment_date` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_comments` ALTER `comment_date_gmt` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_posts` ALTER `post_date` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_posts` ALTER `post_date_gmt` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_posts` ALTER `post_modified` SET DEFAULT '1000-01-01 00:00:00';
ALTER TABLE `wordpress`.`wp_posts` ALTER `post_modified_gmt` SET DEFAULT '1000-01-01 00:00:00';
eg:
Error Code: 1067. Invalid default value for 'post_date'
The questions are
- How to move 'MySql' to an other machine ?
- What's wrong with
ALTER TABLE x ALTER columnY SET DEFAULT '1000-01-01 00:00:00';
?