MySQL WorkbenchMySQL Workbench

MySQL workbench is a graphical application that lets us manage data and perform administrative tasks on MySQL databases. In this tutorial, we will see how to install the program on Ubuntu 18.04 (Bionic Beaver).

In this tutorial you will learn:

  • How to install and configure MySQL workbench
  • How to create a schema and a table via MySQL workbench
  • How to create an E.R diagram by reverse-engineering an existing schema
  • How to execute SQL queries

Software Requirements

CategoryRequirements for Software Version Used
SystemUbuntu and many Debian derivatives such as Linux Mint.
SoftwareMysql-server and Mysql-workbench
OtherPrivileged access to your Linux system as root or via the sudo command and Active MySQL server

Setting up MySQL server

Click here to see the instructions for MySQL server installation.

Installation and connection setup Workbench

To install MySQL workbench on Ubuntu 18.04, all we need to do is to run the following command:

$ sudo apt-get install mysql-workbench 

To launch the program, all we have to do is to go on the Ubuntu app drawer and click on the MySQL workbench launcher icon.

The program will be launched, and the main page will appear

The existing local connection automatically appears in the connection list as Local instance. We will use it to test the application.

Create a new connection

There are many ways we can create a new connection, the most straightforward is by clicking on the “plus” button in the main application window. As soon as we do it, a new window will open: we can use it to setup the connection settings.

The first thing to do is to set the Connection Name, in this case, we will just use “test”. The second thing we must do is to select the Connection Method. In this case, we will use the default option: Standard (TCP/IP). Further down we must setup the basic connection parameters: the hostname (name or IP address) of the machine on which the MySQL server is running,  and the port used for the connection, which by default is 3306.

We must also provide the name of the MySQL user we should connect with and its password. We can choose to store the password in the system keychain or clear an already stored password by clicking on the “Clear” button. If the password is not set here, the application will prompt us to provide it when we use the connection.

Finally, we can set the Default Schema to use when we connect to the server. If we leave this field blank, we will be able to select it later from the list of the available ones.

To test the connection we can click on the Test Connection button; to store the connection we just created, instead, we click on the OK one. The connection should now appear in the list on the main program page.

Modify a connection

Modifying a connection is just as easy. We just right-click on an existing connection name and select Edit Connection from the contextual menu that appears.

As soon as we do it, the same window we used to create the connection will open, letting us perform the changes we need.

Delete a connection

To delete an existing connection, we use a similar procedure: we right-click on the section dedicated to the connection in the main application window, but this time we select Delete Connection from the context menu. The application will ask for confirmation before actually deleting the connection.