MySQL
MySQL

MySQL Workbench & CLI

Once the MySQL server is running, you need a way to actually send it commands. Two common ways to do that are MySQL Workbench (a visual desktop application) and the MySQL command-line client (the CLI). MySQL Workbench gives you a graphical interface: a query editor with syntax highlighting, a tree of your databases and tables in the sidebar, and buttons to run a query and instantly see the results as a table. It's a comfortable place to start, especially for seeing your schema visually. The CLI is text-only. You type mysql -u root -p, enter your password, and you're dropped into a prompt (mysql>) where you type SQL directly and press Enter (ending with ;) to run it. It looks less friendly at first, but it's available almost everywhere, including on servers with no graphical interface at all. Most working developers end up using both: Workbench (or a similar GUI, like phpMyAdmin or DBeaver) for browsing and designing, and the CLI for quick commands, scripts, and situations where a GUI simply isn't available.

Why this matters

  • ·Workbench makes it easy to see your tables, columns, and relationships visually.
  • ·The CLI works on almost any machine, including remote servers with no graphical interface.
  • ·Learning both means you're never stuck if only one of them is available.

Common mistakes

  • ·Relying only on a GUI can leave you unable to work when you only have terminal access.
  • ·In the CLI, forgetting the semicolon leaves your command hanging, waiting for more input.
  • ·Running a destructive command in a GUI's convenient 'run' button is just as risky as in the CLI always read a query before executing it.
Your codePHP
Expected output
+-----------+
| status    |
+-----------+
| connected |
+-----------+
1 row in set

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Frequently asked questions

No. Any SQL client works phpMyAdmin, DBeaver, TablePlus, or the plain CLI are all common alternatives.

Practice questions

Question 1

Write a query that selects your name as a column called student_name.

Your codePHP
Expected output

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Question 2

Write a query that selects two values at once: a name and a favorite subject, each in its own named column.

Your codePHP
Expected output

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

What does the MySQL CLI mainly rely on?