extract_schema_from_file_name is a stored function available with the Sys Schema.

Given a file path, it returns the schema (database) name. The file name is assumed to be within the schema directory, and therefore the function will not return the expected result with partitions, or when tables are defined using the DATA_DIRECTORY table option.

The function does not examine anything on disk. The return value, a VARCHAR(64), is determined solely from the provided path.


SELECT sys.extract_schema_from_file_name('/usr/local/mysql/data/db/t1.ibd');
| sys.extract_schema_from_file_name('/usr/local/mysql/data/db/t1.ibd') |
| db                                                                   |

See also


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.