Command line mysql export / import...

i have a web based application i wrote to enable sales people to manage their sales and contacts. the client has asked me to create an offline version the sales people can take with them in the car, hotel, etc. when they might not have internet access. i was able to get an "offline" version running on a usb thumb drive complete with apahce, mysql, php, etc. works great.

what im trying to do next is:

-before the salesperson leaves the office, they would visit the website and click on a link...ie: export.

or

click on a link on their desktop ... ie: update_db.bat and the script/batch file would connect to myserver.com export the "sales" table to a .sql or .gz file...when done exporting the script would import said file to localhost and update their local copy of the sales table.

make sense....my mysql command line skills are a little rusty and while ive seen a handful of php scripts that will export from myserver.com i am not sure how i would get the remote script to update my local copy.

any ideas? thanks
nriddockAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan_82Commented:
Try using mysqldump, i've done this before but it was awhile ago and i can't remeber the exact syntax of the command.

Try this site http://www.keithjbrown.co.uk/vworks/mysql/mysql_p6.shtml
and goto Using mysqldump to copy databases, it quite near the bottom

it has the following line
$ mysqldump -u admin -p --databases vworks | mysql -u backup -p MyPassword -h remote.server.com

OR goto
http://www.devarticles.com/c/a/MySQL/Backing-Up-Your-MySQL-Databases-With-MySQLDump/2/

With the top example i think it copies from local host to a remote server so you'll have to reverse it, i.e. -h remote.server.com needs to go on the other side of the |

Good Luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
todd_farmerCommented:
The simplest batch file would be something like this:

mysqldump --host=remote_host --user=remote_user --password=remote_pwd db_name | mysql --user=local_user --password=local_pwd db_name

 
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.