LambdaLabTM
Databases & SQL · Class 12 · Getting Started with MySQL
MySQLpractical⏱️ 7 min read

The mysql> Prompt

Everything in this course happens at one prompt. It is worth five minutes to know exactly what you are looking at when it appears — and what to do when it changes shape on you, which it will, probably within your first ten queries.

1Opening the client

MySQL comes in two halves. The server is a program that runs quietly in the background and looks after the data. The client is what you type into. On Windows it is in the Start menu as MySQL 8.0 Command Line Client.

It asks for the password that was set when MySQL was installed. Nothing appears as you type it — not even dots in some versions. That is deliberate, not a broken keyboard. Press Enter, and if the password is right you get this:

the welcome banner, and the prompt at the end of it
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 8.0.46-0ubuntu0.24.04.4 (Ubuntu)
 
Copyright (c) 2000, 2026, Oracle and/or its affiliates.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql>

Only the last line matters. mysql> is the MySQL prompt: the client is connected, it is waiting, and anything you type now goes to the server.

Your banner will not match exactly
The version number and the connection id will be different on your machine, and the copyright year moves. The shape is what you are checking: a welcome, some legal text, and then mysql> on its own line.

2The semicolon runs the query

The banner told you already: Commands end with ; or \g. Pressing Enter is not what runs a query. The semicolon is.

This matters because it lets one query stretch over several lines. Here is a real session where the query is split across two of them:

MySQL command line client
mysql> select count(*)
-> from students;
+----------+
| count(*) |
+----------+
| 12 |
+----------+
1 row in set (0.00 sec)

After the first Enter the prompt changed from mysql> to ->. That is the continuation prompt, and it means “I am still listening; you have not finished”. The moment the semicolon arrived, the whole thing ran as one query.

If the prompt is stuck on ->
Nothing has crashed. You forgot the semicolon on a previous line, and everything you type is being added to a query that has not been run yet. Type ; and press Enter to run it — or type \c and press Enter to throw the half-written query away and get a clean mysql> back.

3Reading what comes back

Replies come in three shapes, and telling them apart is most of what “reading the screen” means here.

1. A resultset — a box of rows

You asked a question and here is the answer, with a count at the bottom: 1 row in set (0.00 sec). If the question matched nothing you get Empty set instead, which is an answer, not a failure.

2. A status line — something changed

Query OK, 1 row affected or Database changed. There is nothing to show, so MySQL just reports what it did.

3. An error — nothing happened

ERROR 1146 (42S02): Table 'lambdalab.student' doesn't exist. Read it: it usually names the exact thing that is wrong. Here, a missing s.

4Case and spacing do not matter

SQL keywords are not case sensitive, and neither are column names in MySQL. All of these do the same thing:

MySQL command line client
mysql> SELECT Name FROM students WHERE Grade = 12;
+--------+
| Name |
+--------+
| Anjali |
| Sohan |
| Ravi |
| Bhim |
+--------+

Notice the heading came back as Name — the case you typed. Many textbooks write keywords in capitals to make them stand out. This course writes them in lower case, matching the class notes. Either is accepted in an exam; just be consistent within one query.

One thing that IS case sensitive
The data. Whether city = "gangtok" matches a stored "Gangtok" depends on how the database was set up, so do not rely on it — type values with the same capitals they were stored with.

5Leaving

MySQL command line client
mysql> exit
Bye

exit or quit closes the client. Your data is safe — every query that changed something was carried out the moment you ran it, so there is nothing to save. What you do lose is the database you chose with use, which is why the next session starts with choosing it again.

6Recap

mysql>

Connected and waiting for a query.

->

Still typing — no semicolon yet. \c abandons the query.

; runs it

Enter alone does not. One query may span many lines.

exit

Closes the client. Replies Bye.

Quick Check

You type a query, press Enter, and the prompt shows -> instead of mysql>. What should you do?

Quick Check

What actually causes a query to run?

Quick Check

Which reply means the query worked but matched no rows?