Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql workbench synchronize different databases

I'm using Mysql workbench to develop my database for my application.

I use at least two databases,for example:

  • my_local : my local testing database that it's always synchronized with mysql workbench
  • myserver_database : the final database in the server,keep in mind that this database is in production and users WILL update it and i can't loose any information stored into it.

Now i can synchronyze my database every time i want but i can't find a way to update the scheme to the final server because they have different names,i get something like:

my_local => N/A
N/A      <= myserver_database

in the past i simply renamed the database in mysql workbench but it doesen't seem to work anymore,probably because of a bug.

I want to be able to synchronize the same workbench scheme with different databases,regardless of the database name,i didn't find a way to force the database name even by modifying the default_scheme.

Please keep in mind i'll do it a lot of times so it's better to avoid triky or dangerous solutions if possible.

like image 551
Plokko Avatar asked Nov 04 '11 00:11

Plokko


People also ask

What is MySQL synchronization?

MySQL synchronization is a process of making two MySQL databases having identical contents. It's a general idea that is realized differently in clustering, replication and other applications. Handy Backup synchronizes MySQL tables via backup and recovery. Free Download. Version 8.4.0, built on June 30, 2022.


1 Answers

I know this question is quite old but I was able to do this on workbench 5.2.40 and there are not many updated resources online explaining how.

First I got a script of my old database:

mysqldump -no-data myolddb > script.sql

(I only want to synch the schemas, this can be done on the workbench too)

now the trick is to modify the script by adding use mynewdb; as its first line, this way the workbench won't say N/A or default schema nonsense.

On the workbench I created a EER model of mynewdb which is on my server, and then "Database->Synchronize with any source" and select from "model Schemadata" to "Script file" in the wizard using the script I modified initially. And then the Synch wizard worked like it should.

like image 114
ilcavero Avatar answered Sep 30 '22 19:09

ilcavero