Install and Get Started with MySQL Workbench on Ubuntu 18.04

Introduction

MySQL Workbench is a unified visual tool for database management. Its graphical interface provides database architects and administrators with an easier way to model data, build and run SQL queries, and maintain a database.

In this tutorial, you will learn how to install, configure, and get started with MySQL Workbench on Ubuntu 18.04.

How to Install and get started with Workbech on Ubuntu.

Prerequisites

  • An Ubuntu 18.04 Linux system
  • Access to a command-line/terminal window (Ctrl+Alt+T)
  • A user account with sudo privileges
  • A MySQL server (as Workbench is designed to work with MySQL databases)

Download and Install MySQL Workbench

MySQL Workbench is very easy to install and available in the local repository. The only thing you need to do is download the package.

As a rule, you should always update and upgrade your system, before any installation:

sudo apt update && sudo apt upgrade

Now you can download and install Workbench with the command:

sudo apt install mysql-workbench

Launch MySQL Workbench

Once you have installed the software, launch the database management tool:

mysql-workbench

The command will prompt Workbench to launch and a new window will appear.

mysql workbench home screen showing mysql connections

If you prefer using the GUI, you can launch Workbench by searching for it in the Activities menu and clicking on the icon as seen below.

locate-mysql-workbench

Configure MySQL Workbench

Before you start managing databases, you may want to modify the default settings. To do so, open the Edit drop-down menu and select Preferences.

edit preferences in mysql workbench

The Workbench Preferences window will appear, consisting of several sections:

  • General Editors
  • SQL Editor
  • Administration
  • Modeling
  • Fonts & Colors
  • Others

Click through the tiles, inspect all the options, and adjust them to fit your needs.

Connecting to a Database

With Workbench installed and configured, you are ready to establish a connection with a database on a local or remote server.

The software automatically creates connection tiles for local servers already set up on the system.

Note: You can only connect to MySQL servers that have already been installed, enabled, and configured for communication. If you are having problems installing MySQL, take a look at our guide on How to Install MySQL on Ubuntu 18.04.

To add a new connection, click on the plus (+) sign on the home page.

add a new connection in workbench

The Setup New Connection dialogue will appear asking for connection information. The parameters will change according to the connection method selected.

Connecting to a Local Database

By default, the dialogue window for new connections fills in the parameters for a local connection that uses the Standard (TCP/IP) connection method. Use this suite if you want to communicate via an IP network.

Local MySQL servers are set to use port 3306. Keep the information as is, unless you have configured a different port number for your local server.

If you are connecting to a newly created server, leave root as the username as it is the only one with system-wide permission. However, to avoid security risks, you can create a new MySQL account and grant the required privileges.

Click on the Test Connection button. If the parameters are correct, the output will inform you it has managed to connect to the server.

output that you are connected to the server

Connect to a Remote Database over SSH

Workbench allows users to quickly set up SSH tunneling and ensure secure communication with remote machines.
If you want to establish a new connection with a remote server over SSH, start by setting the connection method to Standard TCP/IP over SSH. This will open additional parameters.

Apart from the standard requirements, this method asks for several other specifications:

  • SSH Hostname
  • SSH Username
  • SSH Password
  • SSH Key File

Fill in the details and try out the configuration by clicking Test Connection, as shown below.

establish a new connection over SSH with a remote server

Note: Make sure the firewalls on your machines are set to allow communication on the required ports. Add a rule for outbound connections on the host machine and a rule for outbound connections on the remote server.

Uninstall MySQL Workbench

To remove or uninstall MySQL Workbench on an Ubuntu system, use the command:

sudo apt remove mysql-workbench

Conclusion

With the help of this article, you should now know how to install MySQL Workbench on Ubuntu. You also learned how to configure the software and enable connections with MySQL databases.

The next thing you should learn is how to create a database with MySQL Workbench.

原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/224113.html

(0)
上一篇 2022年1月7日
下一篇 2022年1月7日

相关推荐

发表回复

登录后才能评论