Introduction

MySQL is an open-source relational database server — the same relational model as the SQL you've already seen, but with its own client, its own administrative commands, and a few of its own data types layered on top.

Connecting with the mysql CLI

Once MySQL is installed (via your package manager, or the official installer), you connect with the mysql command-line client, giving it a username and asking it to prompt for a password:

shell terminal
$ mysql -u root -p
Enter password: 
Output
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 8.0.36 MySQL Community Server - GPL

mysql>

The mysql> prompt means you're connected and can start typing SQL — the same SELECT/WHERE/JOIN syntax from the site's SQL Course works here unchanged. What's different is everything around queries: how databases and users are managed, and MySQL's own extensions.

Listing databases and checking the version

SQL mysql shell
SHOW DATABASES;
Output
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql               |
| performance_schema |
| sys                 |
+--------------------+
4 rows in set (0.01 sec)

information_schema, mysql, performance_schema, and sys are MySQL's own internal databases — metadata, user accounts, and performance data — present on every fresh install before you create anything of your own.

SQL mysql shell
SELECT VERSION();
Output
+-----------+
| VERSION() |
+-----------+
| 8.0.36    |
+-----------+
1 row in set (0.00 sec)
Note: every command in the mysql CLI needs a trailing semicolon — pressing Enter without one just drops you onto a continuation line (shown as ->) waiting for the rest of the statement. If your prompt looks stuck, you probably just need a ;.