Methods of payment Abuse

Installing MYSQL WORKBENCH in Ubuntu

11.03.2022, 18:59

MySQL Workbench is a graphical tool for MySQL database management designed primarily for database architects and developers. It allows you to visualize the database, as well as conveniently design large queries to it with full syntax and error highlighting. Next, let's see how to install MySQL Workbench in Ubuntu 20.04 using apt repository from developers.

How to install MYSQL WORKBENCH in Ubuntu

MySQL database developers provide their own apt repository from which you can install the database as well as related software, including MySQL Workbench. To install the repository, you must first download the package from the official website, just click on the Download button.

After that select the No thanks link at the bottom, just start my download:

Now save the file toyour Downloads folder:

Once the download is complete, open a terminal and install the downloaded package using the dpkg utility:

$ sudo dpkg -i ~/Downloads/mysql-apt-config_0.8.16-1_all.deb

During the installation process, the program will prompt you to configure the repositories that will be connected. You can choose not to change anything. Just navigate to Ok and then use the Tab key to select the Ok button and press Enter:

Now all that's left is to update the package lists from the repositories:

$ sudo apt update

And then install MySQL Workbench:

$ sudo apt install mysql-workbench-community

Once the installation of the program is complete , you will be able to find it in the main menu. The main window of the program looks like this:

Using MYSQL WORKBENCH.

In the main window you can see all available connections to MySQL. In this case, the program detected a local MySQL server. Initially, the program offers to connect to the database as root user. But if you are using MariaDB, you will not be able to solve the problem, because you can log in as root user only through the terminal.

For this program you will have to create admin user with superuser rights. To do this in the terminal, connect to the database server using the mysql client and execute:

$ sudo mysql -u root

> CREATE USER admin@localhost IDENTIFIED BY 'password';
> GRANT ALL ON *.* TO admin@localhost WITH GRANT OPTION;

Go back to MySQL Workbench and right click on the connection, select Edit Connection. In the window that opens, change Username to admin. Then click the Test Connection button to check that everything really works. If everything is fine the program will show you a window like this:

In addition, for MariaDB you may see a message that this version of the database is not supported and not all features will be available. This is not a big deal. Close the settings window and return to the main window.

Here, click on the edited connection and you will be taken to the query editing interface:

Write some query and click the lightning button to execute it. The result will be shown at the bottom of the screen. Or if it is empty, nothing will be shown:

You can see the contents of some table:

The advantage over PhpMyAdmin here is that you can form very large and complex queries. The program remembers them and you do not need to type the query every time again. In addition, the query can be saved to a file. You can execute only part of the typed queries or only the line under the cursor. This is very useful for designing.

How to delete

To uninstall the program, you just need to execute this command:

$ sudo apt purge mysql-workbench-community

As you can see, it is quite easy to install programs with the help of repositories.