On Fri, Jun 19, 2009 at 6:55 PM, Hans Zaunere <[email protected]> wrote:

> > Hey folks,
>
> Hi.
>
> > I am having some trouble backing up a database from a server in NY to a
> > server in California.
> >
> > When I do this:
> >
> > mysqldump myDatabase | mysql --host=otherTimeZone.com [etc]
> >
> > the data gets there but the timestamp columns (timestamp NOT NULL
> > default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP) end up three
> > hours later. I have learned about the --tz-utc option to mysqldump and
> > that would be lovely, but it's only available in MySQL 5.1.2 and I
> > would rather not get into upgrading (from  5.0.45-log). I thought it
> > would be clever to write a shell script that says echo  'SET
> > time_zone="US/Eastern";' > $DUMP; and then concatenates the rest of the
> > dump to the file which is then fed into the mysql client -- but it
> > doesn't work.
>
> --tz-utc should be available it seems.  From my mysqldump --help



Quite right, my mysqldump recognizes --tz-utc as well, though I swear on my
cats' lives that http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html says
"This option was added in MySQL 5.1.2"

So... using --tz-utc in my case doesn't trigger an error but neither does it
bring any joy: same problem persists.



> But you can also set the timezone of mysql itself:


Not on a shared host you can't, unless you're the boss. (-:



>
>
> http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html
>
> Then again, I always set the OS to the same timezone, regardless of where
> they are in the world.  Some people set to UTC - I set to EST :)
>
> Another approach, depending on exactly the scenario, is to just dump the
> text file to Cali server.  Then when you do a restore, none of this would
> be
> a problem.
>

I might have to do something like that, though I was hoping to keep it
idiot-simple. Ok, super-duper-idiot-simple.

Thanks,



-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to