-
Notifications
You must be signed in to change notification settings - Fork 0
listDatabases
Corey Avis edited this page Sep 23, 2026
·
2 revisions
Retrieves an array of available databases. To optimize performance, it caches the results in the $this->databases variable after the first retrieval. Subsequent calls read from this variable instead of querying the MySQL server, unless a refresh is forced.
This method automatically filters out system databases defined in the configuration blacklist. To retrieve all databases including blacklisted ones, use show('databases') instead.
listDatabases(bool $refresh = false): array
refresh (bool)
: If set to true, bypasses the cached $this->databases variable and forces a fresh query to the MySQL server. (default: false) ^(optional)^
(array) : Returns an array of database names on success (excluding blacklisted databases), or an empty array otherwise.
$databases = $db->listDatabases();
| Config Key | Default Value | Allowed Values | Description |
|---|---|---|---|
| blacklist | ['information_schema', 'mysql', 'performance_schema', 'phpmyadmin'] | array | Databases to ignore |
- No debug errors.