Adding new table to ER Diagram - mysql

I created database and ER Diagram. Then I added new table to exsisting database. Now I would like have this table in my ER Diagram. How can I do it? Have I to create new Diagram? Of course I can use the table tool on the vertical toolbar, but if I have new table I suppose that is better way to get this table in Diagram.

First, always upgrade to the latest MySQL Workbench version (at the time being 6.0.9 with 6.1 around the corner).
I assume you created your EER diagram from the database via reverse engineering. Any time you want to update either the model or the database (schema) run the synchronization in MySQL Workbench. Open a model and go to Database -> Synchronize Model.... This is a two-way tool (model to schema and schema to model), but you can manually define the direction (or to ignore a change). Once you have synchronized your changed schema the new table will appear in the catalog tree where you can drag it to a diagram.

There should be a pane on the left titled Catalog Tree in the tab for your existing EER diagram.
You can drag and drop your new table onto the existing diagram. If the table isn't listed, do a refresh on the dbname in the tree view.

Related

Can I automatically match MySQL Workbench ER diagram with table data type?

I created a ER diagram and table in MySQL Workbench as following:
Now when write the CREATE TABLE command, I need to manually match the datatype. If I change the datatype in the diagram, I have to manually change it too in the CREATE TABLE command.
My question is, is there an automatically way to generate and match the datatype with the ER diagram when creating the table?
I'm using MySQL workbench 8.0.27,
assuming that you have already reverse engineered a schema and formed the corresponding ERD, and for any reason you wish to change a data type of any of your attributes in a given table from the EER Diagram interface,
Its simple.
Double click on the table
The create table interface should pop from the bottom panel
There one can edit attribute names, type and size.enter image description here

MySQL Workbench - All diagrams in EER Model update when working in single diagram

I've created an EER Model for a project and I have a couple diagrams inside the model.
My problem is that I have tables with the same name in all the diagrams and when I update one table, all with the same name suffer the same alterations.
How can I avoid this behavior and have a diagram independant from the others?
With MySQL Workbench it is possible to place the same table on more than one diagram. All these "instances" (we call them figures) represent the same db object. Hence changing that table it will appear changed on all diagrams. It's the same object after all.

MySQL Workbench - How to update 2 different schemas from one EER Diagram?

Is it possible to use one EER Diagram currently associated with a schema called mydb with another schema mydb2?
Not currently. You can only compare two databases if they have the same name. It's a known bug:
Workbench not able to synchronize schemas with different names
Rename database schema makes synchronisation impossible

How to create E-R diagram in mysql

I am using MySQL. There are 28 tables in my database. I've tried to use MySQL Workbench to create E-R diagram. As there are 28 tables, everything is messed up in diagram using MySQL Workbench. Is there any way to create E-R Diagram which shows all relations properly between 28 tables??
Thanks
The only free app I've been able to find that generates decent graphics (not beautiful but quite clear) is SchemaSpy. It's a command line Java program that generates quite comprehensive HTML documentation for any DBMS.
To Create ER Diagram in MySQL follow these steps:
1.First install MySQL Workbench in your computer
Click File->Import->Reverse Engineer MySQL Create Script.
Click Browse and select your SQL create script.
Make Sure "Place Imported Objects on a diagram" is checked.
Click Execute Button.
Click Model->Add Diagram.
Open Catalog Tree and select/drag your tables on your ERR diagram.
ERWin is another good tool. Allowing you to generate erd from sql code and sql code from er diagrams. Its a Drag and Drop utility.
SQL yog is one of the best tool which generate ERD and represents the relationship between different tables.
It is also drag and drop utility and provide complete access to your mysql database.
Open the MySQL Workbench and then go to Database -> Reverse Engineer (in this wizard you have 7 steps to generate the ER Diagram)
1-Connection Options:
For Stored Connection :( Select local instance )
For Password: Click on the Store in Vault.. and then enter your password
Then click on the next.
2-Connect to DBMS:
Click on the next (In this step you do not need to do anything)
3-Select Schemas
Here, select your desire Schema in order to generate an ER Diagram
4-Retrieves Objects
Click on the next (In this step you do not need to do anything)
5-Select Objects
In this step, you can click on the Show Filter to exclude some table if you like
Here, I exclude the emailAddresses table in order not to show that in the ER Diagram
6-Reverses Engineers
Click on the next (In this step you do not need to do anything)
7-Results
Click on the finish to see the Diagram

MySQL Workbench - How to synchronize the EER Diagram

I am creating a visual representation of my existing database with MySQL Workbench and I am able to synchronize the models with the "Database -> Synchronize Model..." menu. However, every time I synchronize (update) my model, I have to recreate the EER Diagram and rearrange all the tables. Is there a way to update or synchronize the EER Diagram as well? Thanks.
Database > Synchronize Model...
Choose Stored Connection
Select the Schemata
Choose which to update: Model or Source (in your case, point arrows to Model)
Are you by any chance using a MySQL DB engine that doesn't support foreign keys (e.g. MyISAM?)? Hence, the relations between the tables is not saved on the MySQL server and get lost during synchronization to the workbench.
But I realize this is only the 'why' of your question. I cannot provide an answer that would preserve your arrangement without using an engine that supports foreign keys, e.g. InnoDB.
I was having a variant of this problem--somehow when I would update the model from the database, one of my tables and its corresponding updatable view wouldn't update.
I believe what was happening is that the model was actually updating, but not the diagram. I didn't really make the distinction at first.
Anyway here's how to get the refresh on the E/R diagram:
Delete the nonupdating object(s) from the diagram. (Just right click and choose "Delete".)
Find the objects in the catalog view in the left sidebar.
Drag them back onto the diagram.
Now they should reflect the model (which should reflect the DB if you followed the accepted answer above.)
When I have more than 3 tables to sync, with changes on relations, I changes arrow direction (model <- source), I check "Skip DB changes and update model only" and Execute...
The "Progress of Model and Database Synchronization" window hang with "Apply changes to Model" highlighted. No processor working, nothing move...
I click the X of the window and redo the process again. Clicking the DB, ignore (all), and selecting less tables to update.
v.5.2.44 ce rev 9933
EDIT: Version 5.2.47 correct this bug !!! YĆ© !