Sometime you may need to populate(sync) local testing table with the production table which is hosted on a remote server.
# This command should be run on local server(SINGLE COMMAND)
mysqldump -t -h [remote_host_ip] -u[remote_User] -p[remote_Password] [remote_DbName] [remote_TableName] | mysql -h localhost -u [local_User] -p[local_Password] [local_DbName]
What if you want to copy last month data only?
mysqldump -t -h [remote_host_ip] -u[remote_User] -p[remote_Password] [remote_DbName] [remote_TableName] -w "column_date_time > NOW() - INTERVAL 1 MONTH"| mysql -h localhost -u [local_User] -p[local_Password] [local_DbName]
Wednesday, June 17, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment