Question

When exporting a file through phpMyAdmin some timestamps are put back an hour. How may I prevent this? I do not want timestamps tampered with. Here's a screenshot for the curious (see the dates.)

I believe the cause may be the SET time_zone = "+00:00"; that is added to every export file.

Is this suppose to happen? Is it a known bug?

I'm running:

-- Server version: 5.5.37-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4

No correct solution

OTHER TIPS

The times are not actually being 'tampered with'.

MySQL interally stores TIMESTAMP columns converted to UTC time, then uses a mixture of system and session (client session) values to determine what to display to the user.

You can check both of these values running the following query yourself.

SELECT @@global.time_zone, @@session.time_zone;

So when your PHPMA script generates its dump, its specifying a session time_zone variable so when you run it MySQL will convert them all from that timezone back to UTC. When you then go to import that to another database, it will still convert them back to the UTC values you're expecting.

So to summarise if the values in the dump with SET time_zone = "+00:00"; are all "1 hour behind" the values you see when querying via PHPMyAdmin, this only appears this way because the connection via PHPMyAdmin will have it's timezone one hour ahead of UTC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top