I have a remote MySQL DB in the cloud on JAWSDB.
I have createdAt
and updatedAt
timestamps for records that are in UTC TZ.
I’ll backup these DBs using mysqldump -h HOST -u USER -p > backup.sql
. I then restore these to a local MySQL Server using
mysql -u USERNAME -p DB_NAME < backup.sql
However, upon inspecting the new local backup…I notice that the createdAt
timestamps are for my local TZ (EST and so currently 5hrs before the UTC version that are actually in JAWSDB). The updatedAt
timestamps are still in UTC
though.
Here’s how I created those timestamp fields btw.
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`updatedAt` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
So it seems like the restore of the dump is converting from UTC to EST just for the createdAt
field. Could this be due to an engine or mysql version mismatch between JawsDB and my local server?
Any insights? Thanks!