title: MySQL data export changes times
body: <p>I have some backup and restore scripts that I am using for my database. The table has a timestamp field. The backup script looks like this:</p>
  
  <pre><code>mysqldump -u user -ppass database --tab="../" --fields-terminated-by="|" --skip-comments table
  </code></pre>
  
  <p>It creates two files, table.sql and table.txt. The restore script looks like this:</p>
  
  <pre><code>mysql -u user -ppass database &lt; "../table.sql"
  mysqlimport -u user -ppass --local --fields-terminated-by="|" database "../table.txt"
  </code></pre>
  
  <p>However the backup script is outputting the wrong time - it's an hour behind what is in the database - but it doesn't correct it when importing.</p>
  
  <p>For example the time on one row was <strong>15:10:25</strong> but when the backup script is run, <strong>14:10:25</strong> is listed in table.txt. When I run the restore script, the same row now has <strong>14:10:25</strong> as the time in the database. If I backup again, it says <strong>13:10:25</strong>! And so on...</p>
  
  <p>I can't figure out why this is. The time zone appears to be set to "SYSTEM" (I'm on GMT). The table.sql file has a few lines mentioning time zones, maybe something is wrong there? Here is the full file in question:</p>
  
  <pre><code>/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8 */;
  /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  /*!40103 SET TIME_ZONE='+00:00' */;
  /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
  /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  DROP TABLE IF EXISTS `news_article`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `news_article` (
    `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
    `title` varchar(100) NOT NULL,
    `alias` varchar(65) NOT NULL,
    `author` tinyint(3) unsigned NOT NULL,
    `category` tinyint(3) unsigned NOT NULL,
    `posted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `opening` text NOT NULL,
    `content` text NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `alias` (`alias`)
  ) ENGINE=MyISAM AUTO_INCREMENT=93 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  
  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  </code></pre>