Syntax MySql

After you successfully logged in to the MySql Database, enter your first command as :

SHOW databases;

The above command shows all the databases that are in our MySql database

Using the Command-Line Interface

The semicolon

Let’s start with the basics. Did you notice the semicolon (;) at the end of the SHOW databases; command that you typed? The semicolon is used by MySQL to separate or end commands. If you forget to enter it, MySQL will issue a prompt and wait for you to do so. The required semicolon was made part of the syntax to let you enter multipleline commands, which can be convenient, because some commands get quite long. It also allows you to issue more than one command at a time by placing a semicolon after each one. The interpreter gets them all in a batch when you press the Return key and executes them in order.
It’s very common to receive a MySQL prompt instead of the results of your command; it means that you forgot the final semicolon. Just enter
the semicolon, press the Return key, and you’ll get what you want.

There are six different prompts that MySQL may present you with below table, so you will always know where you are during a multiline input.

MySql Prompt Meaning
mysql> MySQL is ready and waiting for a command
-> Waiting for the next line of a command
‘> Waiting for the next line of a string started with a single quote
“> Waiting for the next line of a string started with a double quote
`> Waiting for the next line of a string started with a back tick
/*> Waiting for the next line of a comment started with /*