title: MYSQL data import changes time
body: <p>I'm having issues with timezones with MYSQL. Right now, I'm dumping the data via mysqldump, as such: </p>
  
  <pre class="lang-bash prettyprint-override"><code>mysqldump -uuser -ppass --tab c:/temp --skip-dump-date dbName
  </code></pre>
  
  <p>This works exactly as intended, with the data in the database matching the .txt files that are generated. The problem comes with importing the data. To get around some foreign key issues during the import phase, I'm using the following code:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SET FOREIGN_KEY_CHECKS = 0;
  LOAD DATA LOCAL INFILE 'c:/temp/tableName.txt' INTO TABLE tableName;
  SET FOREIGN_KEY_CHECKS = 1;
  </code></pre>
  
  <p>This also has no issues, except afterwards when I check the database, all the <code>TIMESTAMP</code>s are shifted by 5 hours forwards. I know this has to be a problem with time zones (I'm UTC-05:00, so the shift time makes sense), but I don't understand what should be done to stop the database from assuming that a shift in time needs to be done. </p>
  
  <p>Along my searches for answers, I came across a similar SO problem, but the issue was backwards. Importing was fine, exporting was shifted. 
  <a href="https://stackoverflow.com/questions/14886427/mysql-data-export-changes-times">MySQL data export changes times</a> </p>
  
  <p>Furthermore, I have seen some suggestions to look at this information in MYSQL, but I don't exactly know what I should do with this information now that I have it. </p>
  
  <pre><code>SELECT @@global.time_zone, @@session.time_zone;
  </code></pre>
  
  <p>Gives me:</p>
  
  <pre><code>SYSTEM    +00:00
  </code></pre>
  
  <p>Is there a way to tell MYSQL to import without changing <code>TIMESTAMP</code>s? Should I change some sort of time zone setting? If so, should I change it for import, or export? I'm not planning on moving the database across any time zones.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>In the mean time until I know best practice, I have tried the following change directly before using the block of <code>LOAD DATA</code> commands:
  </p>
  
  <pre><code>SET TIME_ZONE = '+00:00';
  </code></pre>
  
  <p>This has solved my problem (where I expect my dump to be the same as the files I used to create the database). Afterwards, I change the time back to <code>-05:00</code>, but I'm not sure if it was necessary.</p>