Install MySQL Workbench on Ubuntu 22.04 with Easy Steps

Posted on

Install MySQL Workbench on Ubuntu 22.04 with Easy Steps

In this tutorial, we’ll guide you through the process to Install MySQL Workbench on Ubuntu 22.04. MySQL Workbench is a powerful unified visual database designing tool and graphical user interface. It’s a favorite among database architects, developers, and Database Administrators. Developed and maintained by Oracle, it provides a comprehensive suite of features including SQL development, data modeling, data migration, and extensive administration tools for server configuration, user administration, backup, and more.

MySQL Workbench empowers users to create new physical data models, construct E-R diagrams, and execute SQL development tasks (like running queries). Its cross-platform compatibility extends to major operating systems such as Mac OS, Windows, and Linux. Notably, MySQL Workbench offers full support for MySQL Server version v5.6 and higher.

Let’s dive into the step-by-step instructions to set up MySQL Workbench on Ubuntu 22.04.

Before we begin, ensure you’re logged in to your server as a non-root user with sudo privileges. If you haven’t already, you can refer to the Initial Server Setup with Ubuntu 22.04 guide for assistance.

1. Install MySQL Deb Package on Ubuntu 22.04

The first step is to install the MySQL Deb Package on your server. You can download it from the MySQL Downloads page:

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb

Next, install the downloaded package using the following command:

sudo apt install ./mysql-apt-config_*_all.deb

During the installation process, you’ll be presented with options to select the components you want to add via the repository. Choose MySQL Server & Cluster, press the TAB button to highlight OK, and then press the Enter key.

MySQL Server & Cluster
MySQL Server & Cluster

Then, select the desired MySQL version available on Ubuntu 22.04. In this example, we’ll select MySQL 8.0.

MySQL Version Ubuntu 22.04
MySQL Version

Again, select OK and then use the TAB key to navigate to OK and press the Enter key.

MySQL Config
MySQL Config

This will automatically configure the latest Debian repository of the Database on your Ubuntu 22.04 system.

Note: If you need to add additional tools using its repository or reconfigure it, run the command below:

sudo dpkg-reconfigure mysql-apt-config

Update your local package index:

sudo apt update

Now, install MySQL on Ubuntu 22.04 using this command:

sudo apt install mysql-server

You’ll be prompted to enter a password for the MySQL server and select a strong authentication method:

MySQL Root Password
MySQL Root Password
Authentication Plugin
Authentication Plugin

Manage MySQL Service

Start and enable the MySQL service:

sudo systemctl enable --now mysql

Verify that the MySQL service is active and running:

sudo systemctl status mysql
**<mark>Output</mark>**
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
     Active: **<mark>active</mark>** (**<mark>running</mark>**) since Mon 2023-01-23 13:19:04 UTC; 55s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
   Main PID: 3873 (mysqld)
     Status: "Server is operational"
      Tasks: 39 (limit: 4575)
     Memory: 364.3M
        CPU: 2.307s
     CGroup: /system.slice/mysql.service
             └─3873 /usr/sbin/mysqld
...

Check the MySQL version:

mysql --version
**<mark>Output</mark>**
mysql  Ver 8.0.32 for Linux on x86_64 (MySQL Community Server - GPL)

2. Secure MySQL Installation Ubuntu 22.04

Secure your MySQL installation by running the security script:

sudo mysql_secure_installation

Follow the prompts, including entering the root password, setting a password component validation policy, and choosing whether to change the root password. Answer as prompted, typing ‘y’ to continue with each step.

Access the MySQL shell:

sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 10
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

3. Install MySQL Workbench Ubuntu 22.04

Now, install MySQL Workbench using the following command:

sudo aptitude install mysql-workbench-community

Launch MySQL Workbench

Once the installation is complete, launch MySQL Workbench either from the terminal:

mysql-workbench

Or, search for "MySQL Workbench" in the "Applications" menu and open it.

Congratulations! You’ve successfully installed MySQL Workbench on your Ubuntu 22.04 system.

Conclusion

In this tutorial, you’ve learned how to Install MySQL Workbench on Ubuntu 22.04. MySQL Workbench is a valuable graphical tool for designing, managing, and administering MySQL databases. It’s a popular choice for database administrators, developers, and data architects alike.

Hope you enjoy using it!

Alternative Installation Methods for MySQL Workbench

While the above method using the MySQL-provided DEB package is reliable, there are alternative approaches to installing MySQL Workbench on Ubuntu 22.04. Here are two distinct methods:

Method 1: Using apt Directly (Without the MySQL DEB Package)

This method relies on the standard Ubuntu repositories to install MySQL Workbench. While it might not always provide the absolute latest version, it’s often simpler and quicker, especially if you don’t need a specific MySQL release.

  1. Update Package Lists: As always, start by updating your package lists to ensure you have the latest information.

    sudo apt update
  2. Install MySQL Workbench: Install MySQL Workbench directly using apt.

    sudo apt install mysql-workbench

    Note that we’re using mysql-workbench instead of mysql-workbench-community. The mysql-workbench-community package is often the one provided by the MySQL DEB repository, while mysql-workbench might point to a version available in the default Ubuntu repositories.

  3. Launch MySQL Workbench: Once installed, launch it as described previously.

    mysql-workbench

Explanation:

This method leverages Ubuntu’s package management system to handle dependencies and installation. It simplifies the process by removing the need to download and install the MySQL DEB package manually. However, be aware that the version available in the Ubuntu repositories might lag behind the latest release from MySQL. This method is ideal if you don’t require a bleeding-edge version and prefer a streamlined installation.

Method 2: Using Snap Package (If Available and Desired)

Snap packages provide a self-contained way to install applications, including their dependencies. While not always the preferred method for database tools, it can be useful in certain scenarios. Note that the availability of a MySQL Workbench Snap package can vary.

  1. Update Snap: Update the Snap package manager.

    sudo snap refresh
  2. Install MySQL Workbench (if available): Check if a MySQL Workbench snap package is available and install it. You might need to search the Snap store for an official or community-maintained package.

    snap find mysql-workbench

    If a suitable package is found, install it using:

    sudo snap install <snap-package-name>

    Replace <snap-package-name> with the actual name of the Snap package (e.g., if the search result shows "mysql-workbench-foo", you’d use sudo snap install mysql-workbench-foo).

  3. Launch MySQL Workbench: Snap packages often have slightly different launch commands. Try launching it directly:

    mysql-workbench

    If that doesn’t work, consult the Snap package’s documentation or use the snap run command:

    snap run <snap-package-name>

Explanation:

Snap packages bundle an application and all its dependencies into a single unit, ensuring that it runs consistently across different systems. However, Snap packages can be larger than traditional packages, and there might be performance considerations. This method is useful if you want to isolate MySQL Workbench from the rest of your system or if you’re having dependency conflicts with other installation methods. It’s important to verify the source and trustworthiness of any Snap package before installing it. Before opting for this method, be aware that Snap packages can sometimes have limitations in accessing system resources or interacting with other applications. Using this method to Install MySQL Workbench on Ubuntu 22.04 might not be as straightforward as the previous methods.

These alternative methods offer flexibility in how you install MySQL Workbench on Ubuntu 22.04. Choose the method that best suits your needs and technical preferences. The key is to consider the version requirements, ease of installation, and any potential drawbacks of each approach.

Leave a Reply

Your email address will not be published. Required fields are marked *