Categories: MYSQL Tutorial

Learn – MySQL Workbench

Learn – MySQL Workbench

MySQL Workbench is a graphical user interface (GUI) or unified visual database design tool for database architects, developers, and database administrators.
Oracle is the company that created and maintains it.
It includes SQL programming, data modelling, data migration, and server configuration, user administration, backup, and other administrative tools.
This Server Administration tool can be used to create new physical data models, E-R diagrams, and SQL development (run queries, etc.).
All major operating systems, including Mac OS, Windows, and Linux, are supported.
MySQL Workbench is compatible with MySQL Server versions 5.6 and above.
The MySQL Workbench has five key features, which are listed below:

SQL Programming:

With the help of the built-in SQL editor, this functionality allows you to run SQL queries, create and manage database connections.

Data Modeling (Conceptualization):

This feature allows you to construct graphical models of the database Schema, do reverse and forward engineering between a Schema and a live database, and change any parts of the database using the full Table editor.
Tables, columns, indexes, views, triggers, partitioning, and other features are available in the Table editor.

 

Administration of the server:

This feature allows you to manage MySQL Server instances by creating users, checking audit data, viewing database health, performing backup and restore, and monitoring MySQL Server performance.

Data Modeling (Design):

This feature allows you to construct graphical models of the database Schema, do reverse and forward engineering between a Schema and a live database, and change any parts of the database using the full Table editor.
Tables, columns, indexes, views, triggers, partitioning, and other features are available in the Table editor.

Data Migration:

This feature allows you to migrate tables, objects, and data from Microsoft SQL Server, SQLite, Microsoft Access, PostgreSQL, Sybase ASE, SQL Anywhere, and other RDBMS to MySQL.
It also allows you to upgrade from older versions of MySQL to the most recent versions.
MySQL Enterprise has the following features:
This feature allows Enterprise solutions like MySQL firewall, MySQL Enterprise Backup, and MySQL Audit to be supported.

Editions of MySQL Workbench

MySQL Workbench comes in three different editions, which are listed below:
  1. Community Edition (Open Source, GPL)
  2. Standard Edition (Commercial)
  3. Enterprise Edition (Commercial)

Community Edition

The Community Edition is an open-source and freely downloadable version of the most popular database system. It came under the GPL license and is supported by a huge community of developers.

Standard Edition

It is the commercial edition that provides the capability to deliver high-performance and scalable Online Transaction Processing (OLTP) applications. It has made MySQL famous along with industrial-strength, performance, and reliability.

Enterprise Edition

It is the commercial edition that includes a set of advanced features, management tools, and technical support to achieve the highest scalability, security, reliability, and uptime. This edition also reduces the risk, cost, complexity in the development, deployment, and managing MySQL applications. Let us understand it with the following comparison chart.

Functionality                                      Community Edition, Standard Edition and Enterprise Edition

Visual SQL Development                           Yes Yes Yes
Visual Database Administration             Yes Yes Yes
Performance Tuning                                    Yes Yes Yes
User and Session Management                Yes Yes Yes
Connection Management                           Yes Yes Yes
Object Management                                       Yes Yes Yes
Data Management                                            Yes Yes Yes
Visual Data Modelling                                   Yes Yes Yes
Reverse Engineering                                      Yes Yes Yes
Forward Engineering                                      Yes Yes Yes
Schema Synchronization                              Yes Yes Yes
Schema & Model Validation                        No Yes Yes
DBDoc                                                                   No Yes Yes
GUI for MySQL Enterprise Backup         No No Yes
GUI for MySQL Enterprise Audit             No No Yes
GUI for MySQL Enterprise Firewall         No Yes Yes
Scripting & Plugins                                          Yes Yes Yes
Database Migration                                         Yes Yes Yes

MySQL Workbench Environment Setup

Here, we are going to learn how we can download and install MySQL Workbench.

Prerequisites :The following requirements / prerequisites should be available in your system to work with MySQL Workbench:
Microsoft .NET Framework 4.5.2
Microsoft Visual C++ Redistributable for Visual Studio 2019
RAM 4 GB (6 GB recommended)

Installation of Mysql

Step 1: Install the MySQL Community Server. To install MySQL Server, double click the MySQL installer .exe file.

Step 2: Choose the Setup Type and click on the Next button. There are several types available, and you need to choose the appropriate option to install MySQL product and features. Here, we are going to select a Custom option because there is a need for only MySQL Server and Workbench. If you need more features, you can choose the Full option.

Step 3: When you click on the Next button, it will give the following screen. In this screen, go to the MySQL Server section, click the plus (+) icon. Here, you need to choose the MySQL Server and add it to the right side box by clicking on the right arrow symbol. Now, in the Application section, you need to do the same thing that you had to perform with MySQL Server and click on the Next button.

Step 4: When you click on Next, it will give the following screen. This screen checks all the requirements for installing MySQL Server and Workbench. As soon as you click on the Execute button, it will install all requirements automatically. Now, click on the Next button.

Step 5: In this screen, click on the Execute button to download and install the MySQL Server and Workbench. When the downloading and installation is complete, click on Next button.

Step 6:  In the next screen, we need to configure the MySQL Server and click on Next button.

Step 7: As soon as you will click on the Next button, you can see the screen below. Here, we have to configure the MySQL Server. Now, choose the Standalone MySQL Server/Classic MySQL Replication option and click on Next.

Step 8: In the next screen, the system will ask you to choose the Config Type and other connectivity options. Here, we are going to select the Config Type as ‘Development Machine’ and Connectivity as TCP/IP, and Port Number is 3306, then click on Next.

Step 9:  Now, select the Authentication Method and click on Next.

Step 10: The next screen will ask you to choose the account, username, and password. After filling all the details, click on the Next button.

Step 11: The next screen will ask you to configure the Windows Service. Keep the default setup and click on Next.

Step 12:  In the next screen, the system will ask you to apply the Server Configuration. For this configuration, click on the Execute button.

Step 13:  Once the configuration has completed, you will get the screen below. Now, click on the Finish button to continue.

Step 14:  In the next screen, you can see that the Product Configuration is completed. Keep the default setting and click on the Next-> Finish button to complete the MySQL package installation.

Step 15:  Once you click the Finish button, the MySQL Workbench should be open on your system.

Step 16:  In the above screen, you need to make a connection. To do this, double click the box designated by the red arrow. Here, you will get the popup screen that asks to enter the password created earlier during the installation. After entering the password, you are able to connect with the Server.

Step 17: If you do not have a connection, you can create a new connection. To make a connection, click the plus (+) icon or go to the menu bar -> Database -> Connect to Database, the following screen appears. Now, you need to fill all the details. Here, you have to make sure that the entered password should be the same as you have created earlier.

Step 18:  After entering all the details, click on the Test Connection to test the database connectivity. If the connection is successful, you will get the following screen. Now, click on OK->OK button to finish the setup.

Step 19:  Once you have finished all the setup, it will open the MySQL Workbench screen. Now, double click on the newly created connection, you will get the following screen where the SQL command can be executed.

MySQL Workbench Administration Tool

The Administration Tool plays an important role in securing the data of the company. Here, we are going to discuss the user’s management, Server configuration, Database backup and restorations, Server logs, and many more.

User Administration

It is a visual utility that allows for managing the user that relate to an active MySQL Server instance. Here, you can add and manage user accounts, grant and drop privileges, view user-profiles, and expire passwords.

Server Configuration

It allows for advanced configuration of the Server. It provides detailed information about the Server and status variable, a number of threads, buffer allocation size, fine-tuning for optimal performance, and many more.

Database backup and restorations

It is a visual tool, which is used for importing/exporting MySQL dump files. The dump files contain SQL scripts for creating databases, tables, views, and stored procedures.

Server Logs

It displays log information for the MySQL Server by each connection tab. For each connection tab, it includes an additional tab for the general error logs.

Performance Dashboard

This tab provides the statistical view of the Server performance. You can open it by navigating to the Navigation tab, and under the Performance section, choose Dashboard.

MySQL Workbench Create, Alter, Drop Database

In this section, we are going to see how a database is created, altered, and drop by using the MySQL Workbench. Let us see in detail one by one.

Create Database

To create a database, do the following steps:

1. Open the MySQL Workbench and logged in using username and password. Then, go to the Navigation tab and click on the Schema menu. Here, you can see all the previously created databases.

2. If you want to create a new database, right-click under the Schema menu and select Create Schema or click the database icon (red rectangle).

3. The new Schema window screen open. Enter the new database name (for example, mytestdb) and use default Collation. Collation is used to store specific data characters, mainly useful for storing foreign languages.

4. A new popup window appears, click Apply->Finish button to create a new database.

5. After the successful creation of the database, you can see this new database in the Schema menu. If you do not see this, click on the refresh icon into the Schema menu.

6. If you want to see more information about the database, select mytestdb database, and click on the ‘i’ icon. The information window displays several options, like Table, Column, Functions, Users, and many more.

7. MySQL Workbench does not provide an option to rename the database name, but we can create, update, and delete the table and data rows from the database.

Drop Database

1. To delete a database, you need to choose the database, right-click on it, and select the Drop Schema option.

2. Select Drop Now option in the popup window and the database including table, data rows will be deleted from the database Server.

MySQL Workbench Create, Alter, Drop Table

In this section, we are going to see how a table is created, altered, and drop by using the MySQL Workbench. Let us see in detail one by one.

Create Table

To create a table, do the following steps:

1. Open the MySQL Workbench and logged in using username and password. Then, go to the Navigation tab and click on the Schema menu. Here, you can see all the previously created databases. You can also create a new database.

2. Select the newly created database, double click on it, and you will get the sub-menu under the database. The sub-menu under the database are Tables, Views, Functions, and Stored Procedures.

3. Select Tables sub-menu, right-click on it and select Create Table option. You can also click on create a new table icon (shown in red rectangle) to create a table.

4. On the new table screen, you need to fill all the details to create a table. Here, we are going to enter the table name (for example, student) and use default collation and engine.

5. Click inside the middle window and fill the column details. Here, the column name contains many attributes such as Primary Key(PK), Not Null (NN), Unique Index (UI), Binary(B), Unsigned Data type(UN), Auto Incremental (AI), etc. The following screen explains it more clearly. After filling all the details, click on the Apply button.

6. As soon as you click on the Apply button, it will open the SQL statement window. Again, click on the Apply button to execute the statement and Finish button to save the changes.

7. Now, go to the Schema menu and select the database which contains the newly created table, as shown in the screen below.

Alter Table

To alter a table, do the following steps:

1. Select the table you want to modify, click on the ‘i’ icon, and you will get the following screen.

2. In the above screen, you can modify the column name, data type, and other table settings.

Drop a Table

1. To delete a table, you need to choose the table, right-click on it, and select the Drop Table option. The following screen appears:
2. Select Drop Now option in the popup window to delete the table from the database instantly.

MySQL Workbench Insert, Read, Update, Delete Data Rows

In this section, we are going to see how we can insert, read, update, and delete data rows by using the MySQL Workbench.

Let us see in detail one by one.

1. Open the MySQL Workbench and logged in using username and password. Then, go to the Navigation tab and click on the Schema menu. Here, we have successfully created a database and student table using MySQL Workbench.

2. Select the table, and when we hour a mouse pointer over the student table, you can see the table icons appears here. Click the table, which will open a new window where the upper section shows the MySQL statement, and the lower section shows the data rows.

3. To enter a data row, select the respected column, and insert the data value. Inserting data value in rows is similar to the Microsoft Excel Worksheet.

4. After entering the data rows, click on the Apply->Apply>Finish button to save the data rows.5. Similarly, we can edit or modify the previously saved data rows. After modification, save new value, click on the Apply button to save changes. It will generate an SQL update statement save the changes to the database

Delete Row

1. To delete an individual row from the table, you need to select a data row, right-click on the right icon in front of the row and select Delete Row(s) option.

2. Now, click Apply->Apply->Finish button to save changes to the database.

MySQL Workbench Export and Import Database(Table)

In this section, we are going to learn how we can export and import the database or table by using the MySQL Workbench.Export Databases(Tables)

1. To export databases or tables, go to the Menu bar, click on Server, and select the Data Export option, as shown in the following screen. It will open a new window of data export settings and options.

2. Select any database, and it will display all the corresponding tables under the selected database. Here, we can also select one or multiple database checkboxes to include the database in the Export file. Similarly, we can select one or multiple tables from the left section of the window.

3. Let us select two databases, namely (mytestdb and mytest2db), including all tables under this database. Now, go to the drop-down setting, we can select ‘Dump Structure and Data’, ‘Dump Data Only’, and ‘Dump Structure Only’ option.

Dump Data and Structure:  It will save both table structure and data rows.

Admin_vb

Recent Posts

Running Multiple MariaDB Instances on Linux Mint

Running Multiple MariaDB Instances on Linux Mint Today lets explore how to run multiple instances…

2 months ago

Learn – MySQL Table Locking

Learn - MySQL Table LockingA lock is a mechanism associated with a table used to…

2 months ago

Learn – MySQL Extract

Learn - MySQL EXTRACT() function in MySQL is related to a DATE and DATETIME function.…

2 months ago

Learn – MySQL Procedure

Learn - MySQL ProcedureA procedure (often called a stored procedure) is a collection of pre-compiled…

2 months ago

Learn – MySQL Date & Time

Learn - MySQL Date & Time In MySQL database, the sql for Date and Time…

2 months ago

Learn – MySQL Literals (Constants)

Learn - MySQL Literals(Constants)Literals are the notations or idea to represent/express a non-changing value. In…

2 months ago

This website uses cookies.