LoginSignup
0
0

More than 1 year has passed since last update.

mysql データ移行 #1067 - Invalid default value for 'created' エラー

Posted at

mariadbのバージョンのせいか、 datetime を dumpしてもうまく入らない。

sql_mode をセットしろと書いてあるが、
sudo vim /etc/my.cnf.d/server.cnf直書きしても
を意味がない

#1067 - Invalid default value for 'last_tweet'

とエラーを吐いてしまう

ということで、

・テーブルはテーブルで作成
・データは後入れ

作戦を行います。

1 まずは テーブルをエクスポート
love_letter DB から friendsテーブルだけをエクスポート

mysql -uroot -p love_letter < friends.sql

2 friends.sql をダウンロードしたあと、テキストエディタで開く
create文の以下を変更

//`last_tweet` datetime NOT NULL DEFAULT current_timestamp(),
`last_tweet` datetime DEFAULT NULL,

3 新サーバーにアップロード

mysql -uroot -p love_letter < friends.sql

とまぁ、地道にやっていきましょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0