Using SHOW to list all databases on a server

To show a list of all of the databases on a server that the current user is allowed to see, use the SHOW DATABASES command as in the following example:

MariaDB [(none)]> SHOW DATABASES; 
+--------------------+ 
| Database           | 
+--------------------+ 
| dbt3_s001          | 
| flightstats        | 
| ham                | 
| information_schema | 
| isfdb              | 
| lds_scriptures     | 
| library            | 
| mysql              | 
| performance_schema | 
| test               | 
| wikidb             | 
+--------------------+ 
11 rows in set (0.00 sec) 

MariaDB [(none)]>

The preceding example is from my personal install of MariaDB; the databases listed when you run the command will almost assuredly be different. This command is useful especially if you're given access to an existing MariaDB database server and want to see what databases are available to you, or if you can't quite remember what a specific database was named.

Tip

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 can 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 the 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 database servers that use their own variant of SQL.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.229.44