I have a database that I'm attempting to migrate into Amazon RDS. I'm generally following the instructions https://engineering.gosquared.com/migrating-mysql-to-amazon-rds.
I've done a mysqldump of the original server, and I've imported the data into the RDS server. Now, I'm ready to import the changes that have occurred since the mysqldump. When I pipe the output of mysqlbinlog to mysql, I get an error about a NULL value.
My table has a TIMESTAMP field called DateReceived
with a default value of CURRENT_TIMESTAMP. When our app inserts records, it leaves DateReceived
as NULL so that the database handles populating the current time.
When we try to import the mysqlbinlog, it chokes on those NULL value inserts.
Here's a snippet of the output from mysqlbinlog:
BEGIN
/*!*/;
# at 42615369
#130813 13:41:12 server id 60 end_log_pos 42615397 Intvar
SET INSERT_ID=173164716/*!*/;
# at 42615397
#130813 13:41:12 server id 60 end_log_pos 42618804 Query thread_id=680551 exec_time=0 error_code=0
use mydatabase/*!*/;
SET TIMESTAMP=1376426472/*!*/;
INSERT INTO email_History (`From`, `Subject`, `DateReceived`) VALUES ('someone@acme.com', 'FW: Message', NULL)
/*!*/;
# at 42618804
#130813 13:41:12 server id 60 end_log_pos 42618831 Xid = 37399491
The error I get from mysql when attempting to import this is:
ERROR 1048 (23000) at line 28: Column 'DateReceived' cannot be null
Here's how my table is structured:
mysql> describe email_History;
+--------------+------------------------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------------------+------+-----+-------------------+----------------+
| From | varchar(512) | YES | MUL | NULL | |
| Subject | varchar(512) | YES | MUL | NULL | |
| DateReceived | timestamp | NO | MUL | CURRENT_TIMESTAMP | |
+--------------+------------------------------+------+-----+-------------------+----------------+
3 rows in set (0.00 sec)
How can I import the binlog?