MySQL Workbench is a Visual database designing and modeling access tool for MySQL server relational database. It facilitates the creation of new physical data models and modification of existing MySQL databases with reverse/forward engineering and change management functions.
1. MySQL Work Bench
VISUAL DATABASE DESIGNING AND MODELING
1
A G A L Danushka | SEU/IS/14/PS/101
2. Introduction 2
MySQLWorkbench is a Visual database designing and
modeling access tool for MySQL server relational
database. It facilitates creation of new physical data
models and modification of existing MySQL databases
with reverse/forward engineering and change
management functions.
3. Why we should choose Work Bench?
MySQLworkbench has tools that allow developers and database administrators visually
create physical database design models that can be easily translated into MySQL
databases using forward engineering.
MySQL workbench supports creation of multiple models in the same environment.
It supports all objects such as tables, views, stored procedures, triggers, etc. that make
up a database.
MySQL workbench has a built in model validating utility that reports any issues that
might be found to the data modeler.
It also allows for different modeling notations and can be extended by using LUA a
scripting language.
3
4. Installation
This is a 2 step process
1) Install MySQL Community Server
2) Install MySQL workbench.
Note: You will require Administrator or Power User Privileges to perform
installation.
4
8. Create MySQL Server Connection 8
Click " + " in MySQL Workbench Home
Window. This will open Setup New Connection .
9. Create MySQL Server Connection cnt.. 9
Click Configure Server Management
button in Setup New Connection
window to check the cofiguration of
the MySQL server.
10. Create MySQL Server Connection cnt.. 10
A new window opens named
Configure Local Management . Click
Next button to continue.
11. Create MySQL Server Connection cnt.. 11
Next it will open a pop up window
asking your root password to test your
connection with the local mysql server
instance. The password is the one you
set during installation of MySQL
Workbench. Enter your password and
press OK
12. Create MySQL Server Connection cnt.. 12
Next the Wizard will test connections
to database. If test fails, go back and
correct database connection
parameters. Else if all tests are
sucessful click Next to continue.
13. Create MySQL Server Connection cnt.. 13
After that a new wizard will open
about Local Service Management - It
lets you switch between multiple mysql
severs installed on one machines. As a
beginner you can bypass this and click
Next to continue.
14. Create MySQL Server Connection cnt.. 14
The Wizard will then check ability to
access MySQL Server Configuration
File, and test start/stop commands.
15. Create MySQL Server Connection cnt.. 15
Next you can review current
configurations. After reviewing the
configurations, Click Finish to finsh
server cofiguration
16. Create MySQL Server Connection cnt.. 16
Next Step is to setup a
connection, which can be
used to connect to server. If
you have not created a
connection already, you can
use the default values given.
Click on Test Connection [ 2
] after entering the
Connection Name [ 1 ].
17. Create MySQL Server Connection cnt.. 17
A new dialog box will open
asking you password to
root/selected user. If your
MySQL root user has a
password, you can enter
that using Store in Vault
feature. Click OK.
18. Create MySQL Server Connection cnt.. 18
If the entered password for
the user is correct then the
following screen will show.
Click on both OK buttons
and you will be good to go
19. ER Modeling 19
In the MySQL workbench , Click - "+" Button Double click on Add Diagram button to open the
workspace for ER diagrams.
20. ER Modeling cont.. 20
Let's now create the members
table
1.Drag the table object from the
tools panel
2.Drop it in the workspace area.
An entity named table 1 appears
3.Double click on it. The
properties window shown below
appears
Repeat this for all tables
21. ER Modeling cont.. 21
Lets create relationship between
two tables
Select the place relationship using
existing columns too
Click on membership_number in
the Members table
Click on reference_number in the
MovieRentals table
23. Forward engineering 23
MySQL workbench has utilities that support forward
engineering. Forward engineering is a technical term is to
describe the process of translating a logical model into a
physical implement automatically.
25. Forward engineering cont.. 25
The next window, allows you to
connect to an instance of MySQL
server.
Click on the stored connection
drop down list and select local
host. Click Execute
27. Forward engineering cont.. 27
The next screen shows the
summary of objects in our EER
diagram.
Keep the selections default and
click Next.
28. Forward engineering cont.. 28
The window shown below
appears.
This window allows you to preview
the SQL script to create our
database.
We can save the scripts to a *.sql"
file or copy the scripts to the
clipboard.
Click on next button
29. Forward engineering cont.. 29
The window shown below
appears after successfully creating
the database on the selected
MySQL server instance.
30. SQL using MySQL Workbench 30
We are now going to use MySQL
workbench to generate the script that
will display all the field names from
our categories table.
1. Right Click on the Categories Table.
Click on "Select Rows - Limit 1000"
2. MySQL workbench will
automatically create a SQL query and
paste in the editor.
3. Query Results will be show