Accessing database metadata

MySQL provides access to several aspects of databases, tables, or extensions thereof. Combining the various options creates the potential for interactive programs, as we will see later in this chapter. As with the MySQL environmental commands, all statements discussed here presume the use of SHOW.

DATABASES

If you are creating a wholly interactive system for database administration, you will need to access the list of databases. To do this in MySQL, we use the following command:

mysql> SHOW DATABASES;

The result is a single column table showing all known databases on the system to which the user has access. Note that the appearance of a database on the list does not indicate permission to access it. Rather, you would ...

Get MySQL for Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.