• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Same MySQL database on two different computers

Hi Experts

Is there a way that I can 'sync' copies of a MySQL db between two different computers?

I have a desktop and laptop (both running Windows 7, MySQL Server 5.5 and PHP and IIS) and in the main, I do stuff on my desktop but there are times when I use the laptop, which is why I need to sync the one database between the two machines.

Any ideas?

Martin Cotterill
Martin Cotterill
  • 2
1 Solution
It's pretty straight forward with master and slave databases,
step by step guide can be found here:
Martin CotterillDabblerAuthor Commented:
Thanks for the reply Ss.

Please tell me there's an easier way...

What's the reasoning behind not being able to make a direct copy of the data directory from one machine to the data directory on the other?

I'm new to all this you see.

I was thinking that you need automatic live 'sync' between two machines, and therefore you need one master database and other slave, but if you want transfer data from one database to another each time you move from one machine to another, you can use MySQL Workbench. It's free software can be installed on Win7 as well.
theGhost_k8Database ConsultantCommented:
ofcourse you will have to dump and restore the database.
The easiest way for you is:
- make sure you have same mysql-config on both laptop and desktop
- Stop mysql server on desktop
- Sto mysql server on laptop
- copy mysql data directory from laptop to desktop data directory location

Better is using mysqldump:
mysqldump -uUSER -pPASSWORD --databases DBNAME > dbname.sql
copy file to laptop
mysql -uUSER -pPASSWORD < dbname.sql
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now