Database Reference
In-Depth Information
If the database does not exist when we try to
USE
it, we will get the following error.
MariaDB [(none)]> use test1;
ERROR 1049 (42000): Unknown database 'test1'
Listing all databases on a server
To show a list of all of the databases on a server, use the
SHOW DATABASES
command
as in the following example:
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dbt3_s001 |
| flightstats |
| mysql |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.00 sec)
MariaDB [(none)]>
You may have noticed in the previous examples that all the commands
ended with a semi-colon (
;
). This is called the
delimiter
and it is a
characteristic feature of
Structured Query Language
(
SQL
). We interact
with the command-line client using this language. In basic terms, SQL is
a computer language optimized for interacting with a database. MariaDB
uses its own variant of SQL which is similar to but not exactly the same
as the SQL variants used by other databases. When we learn how to write
SQL statements for MariaDB, we also learn a good deal about writing
SQL for other databases, but there are some differences. For instance,
USE
and
SHOW
are commands, which exist in MariaDB but not in some other
databases that use their own variety of SQL.