r/mysql • u/Dacke • Jan 20 '26
question Syncing database installs
Hello,
I'm currently taking an introductory class on databases, and I have a bit of a quality of life issue. At home, I have a desktop computer with a comfortably large screen, good keyboard, and all that stuff. But when going to class, I instead use a laptop. I have MySQL installed on both. Is there a reasonably easy way to sync those installations so if I change something on my desktop, it will also change on my laptop and vice versa?
I have previously used git/github to keep things synched when writing HTML/CSS/JS code, but is it possible to do the same for MySQL?
2
u/ssnoyes Jan 20 '26
For tiny amounts of data (which it's likely to be in a class setting), you could keep everything in git.
mysqldump --all-databases > mydb.sqland push that mydb.sql into git. On checkout,mysql < mydb.sqland you're up to date.When you get into a scenario where the data exceeds a few MB, this is no longer practical, but it's good enough when you're just learning basic syntax.
1
u/Lumethys Jan 20 '26
No, whether you mean config or data, or at least not in the way you want
For config, the industry standard is use a docker container for the database. Docker uses a text file to define your requirements (like version, config, which command to run...) and then build an isolated environment to that spec.
Imagine a team of 10 developers. You would want everyone install the exact same version with the exact same config for a given project. That's the use case of Docker
However, when someone changes the docker file. Everyone must update their own docker file, destroy their current db and rebuild it. You can use Git to track this Dockerfile. But i doubt this is what you want.
For data, There are ways to transfer data across multiple instances of db.
1
u/GiveMeAnAlgorithm Jan 21 '26
If you feel a bit adventurous, why don't you set up a (free) cloud account that lets you run MySQL? You could then connect to the same database from your laptop and from your home setup.
Not sure if replication would work for you, so this is definitely easier.
Edit: For MySQL I tried the always free Database on Oracle Cloud Infrastructure, that you can expose for demo purposes.