# MySQL Export

**URL:** https://community.mp3tag.de/t/mysql-export/10187
**Category:** Export
**Created:** [March 26, 2010, 5:27pm UTC](https://community.mp3tag.de/t/mysql-export/10187 "2010-03-26T17:27:37Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Mp1337](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@Mp1337](https://community.mp3tag.de/u/Mp1337)
#### Post date: [March 26, 2010, 5:27pm UTC](https://community.mp3tag.de/t/mysql-export/10187/1 "2010-03-26T17:27:37Z")

</div>

Hello,

I guess many of you would like to get all data into a MySQL database. This is possible with a simple MySQL export script I've made.  
Go to "Export" in Mp3Tag, create a new configuration, name it as you prefer. Then add the following code:

> [@](#):
>
> $filename(sql.txt,utf-8)  
> INSERT INTO music\_stats (list\_date, tot\_tracks, tot\_length) VALUES ("%\_date%", "%\_total\_files%", "%\_total\_time2%");  
> $loop(%\_title%)INSERT INTO music '('title, artist, album, length, year, genre')' VALUES '('"%title%", "%artist%", "%album%", "%\_length%", "%year%", "%genre%"')';  
> $loopend()

This will generate a SQL code which you can run in PHPMyAdmin or somewhere else you run your SQL scripts. You need to create two tables first, one named "music\_stats" which has 3 fields, and another one named "music", with 6 fields.  
I've used VARCHAR for the title, artist, album, year, genre, list\_date and tot\_length, and the others INT.  
When running the SQL, all tables will be filled with the right data if you did all correct!

You can modify the code however you want. If you have any questions, please feel free to do so 🙂

Example of some AC/DC from my database, first a part of the SQL code Mp3Tag generated with the script above, second a screenshot of the part (the first page) after putting it into the database using phpMyAdmin:

> [@](#):
>
> INSERT INTO music\_stats (list\_date, tot\_tracks, tot\_length) VALUES ("26-3-2010", "5639", "452:57:04");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Baby, Please Don't Go", "AC/DC", "'74 Jailbreak", "04:52", "1974", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Jailbreak", "AC/DC", "'74 Jailbreak", "04:43", "1974", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Show Business", "AC/DC", "'74 Jailbreak", "04:48", "1974", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Soul Stripper", "AC/DC", "'74 Jailbreak", "06:26", "1974", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("You Ain't Got A Hold On Me", "AC/DC", "'74 Jailbreak", "03:34", "1974", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Are You Ready (Live)", "AC/DC", "AC/DC Live", "04:35", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Back In Black (Live)", "AC/DC", "AC/DC Live", "04:29", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Bonny (Live)", "AC/DC", "AC/DC Live", "01:03", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Dirty Deeds Done Dirt Cheap (Live)", "AC/DC", "AC/DC Live", "05:03", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Fire Your Guns (Live)", "AC/DC", "AC/DC Live", "03:42", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("For Those About To Rock (Live)", "AC/DC", "AC/DC Live", "07:08", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Heatseeker (Live)", "AC/DC", "AC/DC Live", "03:38", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Hells Bells (Live)", "AC/DC", "AC/DC Live", "06:02", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("High Voltage (Live)", "AC/DC", "AC/DC Live", "10:34", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Highway To Hell (Live)", "AC/DC", "AC/DC Live", "03:54", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Jailbreak (Live)", "AC/DC", "AC/DC Live", "14:45", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Let There Be Rock (Live)", "AC/DC", "AC/DC Live", "12:19", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Money Talks (Live)", "AC/DC", "AC/DC Live", "04:19", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Shoot To Thrill (Live)", "AC/DC", "AC/DC Live", "05:24", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Sin City (Live)", "AC/DC", "AC/DC Live", "05:41", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("T.N.T. (Live)", "AC/DC", "AC/DC Live", "03:48", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("That's The Way I Want My Rock (Live)", "AC/DC", "AC/DC Live", "03:58", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("The Jack (Live)", "AC/DC", "AC/DC Live", "06:58", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("The Razors Edge", "AC/DC", "AC/DC Live", "04:36", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Thunderstruck (Live)", "AC/DC", "AC/DC Live", "06:35", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Who Made Who (Live)", "AC/DC", "AC/DC Live", "05:17", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("Whole Lotta Rosie (Live)", "AC/DC", "AC/DC Live", "04:31", "1992", "Hard Rock");  
> INSERT INTO music (title, artist, album, length, year, genre) VALUES ("You Shook Me All Night Long (Live)", "AC/DC", "AC/DC Live", "03:55", "1992", "Hard Rock");

😲. Things you discover while doing this. The reason my database needs to be so tidy is because I'm a radio DJ, and I wan't to offer the right information to listeners + the request page based on this needs to carry the correct information to ofcourse.

I'm now going to read out all data in the database and show it on a nice webpage to share my collection with my mates 🙂 (not as downloadable files, but for information about what I've got)

---

_[View the full topic](https://community.mp3tag.de/t/mysql-export/10187)._
