Software & AppsOperating SystemLinux

How To Connect MySQL Workbench to MySQL Server on Ubuntu

Ubuntu 2

In this article, we will be discussing how to connect MySQL Workbench to a MySQL Server on Ubuntu. MySQL Workbench is a unified visual tool that provides a graphical interface for MySQL database design, SQL development, and comprehensive administration tools for server configuration, user administration, and much more.

Prerequisites

Before we start, make sure you have the following:

  • Ubuntu 18.04 or higher installed on your system.
  • MySQL Server installed and running.
  • MySQL Workbench installed on your system.

Connecting MySQL Workbench to MySQL Server

Solution 1: Using Terminal

Open a terminal in Ubuntu (Ctrl+Alt+T) and enter the following command:

sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service

This command allows MySQL Workbench to access the Gnome Passwords & Keys facility, which is often necessary for establishing a connection with the MySQL server. The sudo command is used to execute the command with root privileges, snap connect is used to connect the snap interfaces, mysql-workbench-community:password-manager-service is the snap and plug we want to connect, and :password-manager-service is the slot we want to connect to.

After running this command, try connecting MySQL Workbench to the MySQL server again.

Solution 2: Using Ubuntu Software Application

If the terminal command doesn’t work, you can also change the permissions directly from the Ubuntu Software application.

  1. Open the Ubuntu Software application.
  2. Search for “mysql-workbench” and select “MySQL Workbench Community”.
  3. Navigate to the “Permissions” section.
  4. Enable the options for “Read, add, change, or remove saved passwords” and “ssh-keys” (if applicable).

After changing these permissions, try connecting MySQL Workbench to the MySQL server again.

Solution 3: Using .deb File

Another solution is to download and install the MySQL Workbench .deb file directly from the MySQL Community Downloads website.

  1. Visit the MySQL Community Downloads website.
  2. Choose the appropriate operating system and version.
  3. Save the file in the Downloads folder.
  4. Open a terminal and navigate to the Downloads folder using the command:
cd ~/Downloads
  1. Install MySQL Workbench using the following command:
sudo apt-get install ./mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb

In this command, sudo apt-get install is used to install the package, and ./mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb is the path to the package file.

After the installation is complete, open MySQL Workbench from the Applications menu and attempt to connect to the server.

Conclusion

Connecting MySQL Workbench to a MySQL server on Ubuntu can sometimes be a bit tricky due to permissions and AppArmor policies. However, the solutions provided in this article should help you establish a successful connection. If you are still facing issues, you might want to refer to the official MySQL documentation for further troubleshooting.

Remember, it’s always important to keep your system and software up-to-date to ensure compatibility and security. Happy coding!

What is MySQL Workbench?

MySQL Workbench is a unified visual tool that provides a graphical interface for MySQL database design, SQL development, and comprehensive administration tools for server configuration, user administration, and much more.

What are the prerequisites for connecting MySQL Workbench to MySQL Server on Ubuntu?

The prerequisites for connecting MySQL Workbench to MySQL Server on Ubuntu are: Ubuntu 18.04 or higher installed on your system, MySQL Server installed and running, and MySQL Workbench installed on your system.

How can I connect MySQL Workbench to MySQL Server using the terminal?

To connect MySQL Workbench to MySQL Server using the terminal, open a terminal in Ubuntu (Ctrl+Alt+T) and enter the command: sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service. This allows MySQL Workbench to access the Gnome Passwords & Keys facility, which is often necessary for establishing a connection with the MySQL server.

What should I do if the terminal command doesn’t work?

If the terminal command doesn’t work, you can also change the permissions directly from the Ubuntu Software application. Open the Ubuntu Software application, search for "mysql-workbench", select "MySQL Workbench Community", navigate to the "Permissions" section, and enable the options for "Read, add, change, or remove saved passwords" and "ssh-keys" (if applicable).

Can I download and install MySQL Workbench from the MySQL Community Downloads website?

Yes, you can download and install MySQL Workbench from the MySQL Community Downloads website. Visit the website, choose the appropriate operating system and version, save the .deb file in the Downloads folder, open a terminal, navigate to the Downloads folder using the command cd ~/Downloads, and install MySQL Workbench using the command sudo apt-get install ./mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb.

Where can I find further troubleshooting information?

If you are still facing issues, you can refer to the official MySQL documentation for further troubleshooting. The documentation can be found at: MySQL documentation.

Leave a Comment

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