MySQL is one of the most widely used relational database management systems, and MySQL Workbench provides a graphical interface that makes database administration much easier. In this tutorial, you’ll learn how to install MySQL Server and MySQL Workbench on a Linux system, verify that the database service is running, and create your first connection in Workbench.
Whether you’re a beginner learning databases or a developer setting up a local database environment, this guide walks through each step clearly and practically.
Prerequisites
Before you begin, make sure:
- You have a Linux system with apt package management available.
- You have a user account with sudo privileges.
- The MySQL Workbench .deb package has already been downloaded.
Note: The commands in this guide should be run from a terminal window.
Step 1: Install and Verify MySQL Server
The first step is to install the MySQL database server on your Linux machine.
Update the Package List
Start by updating your system’s package information to ensure you’re installing the latest available packages.
sudo apt update

This command refreshes your package repository information so Linux knows about the latest software versions available.
Install MySQL Server
Once the package list is updated, install the MySQL server package.
sudo apt install mysql-server

This command installs the MySQL database server and all required dependencies.
Start the MySQL Service
After installation completes, start the MySQL service.
sudo systemctl start mysql
![]()
This command starts the MySQL database server so it can accept connections.
Check the Service Status
Verify that MySQL is running correctly.
sudo systemctl status mysql
It displays the current status of the MySQL service.
Confirm MySQL Installation
You can also verify the installation by opening the MySQL command-line interface.
sudo mysql -u root -p

If the command opens the MySQL prompt and displays something similar to:
mysql>
then MySQL has been installed successfully and is ready to use.
Step 2: Install MySQL Workbench
MySQL Workbench is a graphical tool that allows you to manage databases, execute SQL queries, and perform administration tasks without relying entirely on terminal commands.
Navigate to the Downloads Folder
If the downloaded Workbench package is stored in your Downloads folder, move there first.
cd Downloads
It changes the current directory to the Downloads folder where the installation package is located.
Install the MySQL Workbench Package
Run the following command to install the downloaded package:
sudo dpkg -i mysql-workbench-community_8.0.46-1ubuntu24.04_amd64.deb

It installs the MySQL Workbench package from the downloaded .deb file.
Fix Dependency Issues (If Needed)
If dependency-related errors occur during installation, run:
sudo apt --fix-broken install

This command automatically installs missing dependencies and resolves package installation issues.
Important: Only run this command if the Workbench installation reports dependency errors.
Open MySQL Workbench
After the installation finishes, launch MySQL Workbench using either of the following methods:
mysql-workbench
Or open it from your system’s Applications menu.
Step 3: Create a MySQL Connection in Workbench
Once Workbench opens, you’ll need to create a connection to your local MySQL server.
Create a New Connection
Enter the following connection details:
Hostname: 127.0.0.1
Port: 3306
Username: root

These settings tell MySQL Workbench to connect to the local MySQL server running on your machine.
Save the Password
Click Store in Keychain and enter your MySQL password. This allows Workbench to securely remember your password so you don’t have to enter it every time.
Test the Connection
Click Test Connection.

Workbench attempts to connect to the MySQL server using the provided settings. If the connection succeeds, you should receive a confirmation message.
Save the Connection
After a successful test, save the connection. You can now open the connection from the Workbench home screen whenever you need to access your database server.
Start Using MySQL Workbench
With the connection configured, you can begin:
- Creating databases
- Creating tables
- Running SQL queries
- Managing users and permissions
- Monitoring database activity
Troubleshooting Tips
a) MySQL Service Is Not Running
Check the service status:
sudo systemctl status mysql

If necessary, start the service again:
sudo systemctl start mysql
b) Workbench Installation Fails Due to Dependencies
Run:
sudo apt --fix-broken install
Then retry the installation if required.
c) Connection Test Fails
Verify that:
- MySQL is running.
- The hostname is set to 127.0.0.1.
- The port is 3306.
- The correct root password is being used.
Conclusion
You have successfully installed MySQL Server and MySQL Workbench on Linux. After verifying that the MySQL service is running, you installed Workbench, created a local connection, and tested access to the database server.
With your environment ready, you can start creating databases, managing tables, and executing SQL queries through both the command line and the graphical Workbench interface.



