# format\_path

{% hint style="info" %}
Sys Schema is available from MariaDB 10.6.
{% endhint %}

## Syntax

```
sys.format_path(path)
```

## Description

`format_path` is a [stored function](../../../../server-usage/stored-routines/stored-functions) available with the [Sys Schema](..) that, given a path, returns a modified path after replacing subpaths matching the values of various system variables with the variable name.

The system variables that are matched are, in order:

* [datadir](../../../../../server-management/variables-and-modes/server-system-variables#datadir)
* [tmpdir](../../../../../server-management/variables-and-modes/server-system-variables#tmpdir)
* [slave\_load\_tmpdir](../../../../../ha-and-performance/standard-replication/replication-and-binary-log-system-variables#slave_load_tmpdir)
* [innodb\_data\_home\_dir](../../../../../server-usage/storage-engines/innodb/innodb-system-variables#innodb_data_home_dir)
* [innodb\_log\_group\_home\_dir](../../../../../server-usage/storage-engines/innodb/innodb-system-variables#innodb_log_group_home_dir)
* [innodb\_undo\_directory](../../../../../server-usage/storage-engines/innodb/innodb-system-variables#innodb_undo_directory)
* [basedir](../../../../../server-management/variables-and-modes/server-system-variables#basedir)

## Examples

```sql
SELECT @@tmpdir;
+------------------------------------+
| @@tmpdir                           |
+------------------------------------+
| /home/ian/sandboxes/msb_10_8_2/tmp |
+------------------------------------+

SELECT sys.format_path('/home/ian/sandboxes/msb_10_8_2/tmp/testdb.ibd');
+------------------------------------------------------------------+
| sys.format_path('/home/ian/sandboxes/msb_10_8_2/tmp/testdb.ibd') |
+------------------------------------------------------------------+
| @@tmpdir/testdb.ibd                                              |
+------------------------------------------------------------------+
```

<sub>_This page is licensed: CC BY-SA / Gnu FDL_</sub>

{% @marketo/form formId="4316" %}
