# MySQL Export Escaping paths

**URL:** <https://community.mp3tag.de/t/mysql-export-escaping-paths/56010>\
**Category:** Support\
**Created:** [January 23, 2022, 11:06am UTC](https://community.mp3tag.de/t/mysql-export-escaping-paths/56010 "2022-01-23T11:06:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlie](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/d6d6ee/32.png) [@charlie](https://community.mp3tag.de/u/charlie)\
**Post date:** [January 23, 2022, 11:06am UTC](https://community.mp3tag.de/t/mysql-export-escaping-paths/56010/1 "2022-01-23T11:06:12Z")

</div>

Hi

I'm trying to export my tag data into a MySQL database, I have a script but its not doing the escaping on the path (I think I need double \ for each directory) and if the filename has ' sign it breaks it completely.

Is there anyway of doing this escaping automatically as part of the export from mp3tag? Current export file below;  
Thanks in advanace

```auto
$filename(sql.txt,utf-8)
$loop(%_title%)INSERT INTO mixed_in_key_data '('track_title, artist, album, track_length, year, genre, bpm, initial_key, energy_level, folder_path ')' VALUES '('"%title%", "%artist%", "%album%", "%_length_seconds%", "%year%", "%genre%", "%BPM%", "%INITIALKEY%", "%ENERGYLEVEL%", "%_path%"')';
$loopend()

```

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [January 23, 2022, 11:41am UTC](https://community.mp3tag.de/t/mysql-export-escaping-paths/56010/2 "2022-01-23T11:41:55Z")

</div>

I would load the complete file into a text editor like Notepad++ and execute a search & replace for `\` with `\\` and `'` with `\'` or whatever your database import accepts. Don't forget all the other characters, you have to escape the same way: [MySQL :: MySQL 8.0 Reference Manual :: 9.1.1 String Literals](https://dev.mysql.com/doc/refman/8.0/en/string-literals.html#character-escape-sequences)

They can occur everywhere in your ARTIST, ALBUM, TITLE...

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [January 23, 2022, 11:56am UTC](https://community.mp3tag.de/t/mysql-export-escaping-paths/56010/3 "2022-01-23T11:56:52Z")

</div>

> [@charlie](#):
>
> `$loop(%_title%)`

Do you have any data in %\_title%? If not, then you can simply use $loop(1).

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:29pm UTC](https://community.mp3tag.de/t/mysql-export-escaping-paths/56010/4 "2026-02-09T12:29:38Z")

</div>


