DEV Community

LAKSHMI G
LAKSHMI G

Posted on

How to Install MySQL and MySQL Workbench in Linux (Simple Explanation)

step 1

  • First, update your Linux system by running the command sudo apt update.
  • After updating, install the MySQL server using sudo apt install mysql-server.
  • This installs the main database system called MySQL. Once the installation is finished, start the MySQL server using sudo systemctl start mysql.
  • To check whether MySQL is running properly, run sudo systemctl status mysql.
  • If it shows active (running), it means the MySQL server is working correctly.
  • You can also confirm it by opening the MySQL terminal with sudo mysql.
  • If the terminal shows mysql>, the database server is successfully installed.

step 2
Next, install MySQL Workbench, which is a graphical tool used to manage databases easily.
Go to your Downloads folder by running cd Downloads, then install the Workbench package using sudo dpkg -i mysql-workbench-community_8.0.46-1ubuntu24.04_amd64.deb.
If any dependency errors appear during installation, fix them using sudo apt --fix-broken install.
After the installation is completed, open MySQL Workbench by typing mysql-workbench in the terminal or by opening it from the Applications menu.

step 3

  • When MySQL Workbench opens, create a new connection by entering the hostname 127.0.0.1, port 3306, and username root.
  • Then click Store in Keychain to save your password.
  • After entering the password, click Test Connection to check if the connection is successful.
  • If the test is successful, save the connection.
  • Now you can start using MySQL Workbench to create databases, tables, and run SQL queries easily.

Commands

  1. - sudo apt update
  2. - sudo apt install mysql-server(Press Y if asked.)
  3. - sudo systemctl start mysql (you should see active (running))
  4. - sudo systemctl status mysql
  5. - sudo mysql (If it opens like:mysql>
  6. - then MySQL server is working. command-exit;
  7. - cd Downloads
  8. - sudo dpkg -i mysql-workbench-community_8.0.461ubuntu24.04_amd64.deb
  9. - Fix dependency if needed:sudo apt --fix-broken install
  10. - mysql-workbench
  11. - Create Connection

Top comments (0)