MySQL Output Converter

While I’m at work I pretty much always have a terminal window open with a MySQL prompt. Whether it’s helping someone troubleshoot an account problem, looking up stats, or gathering data for reports, I run a lot of queries throughout the day.

Oftentimes I want to make a chart with that data, which requires me switching database servers, looking up the MySQL CSV syntax on morgamic’s blog, and scp’ing the CSVs to my laptop.

I’ve grown tired of doing that, and tonight I finally did something about it: MySQL Output Converter

It’s a simple little page that lets you paste your MySQL results that look like this:

mysql> SELECT * FROM word_replacements;
+----+-----------+-------------+---------------------+
| id | word      | replacement | created             |
+----+-----------+-------------+---------------------+
|  1 | favourite | favorite    | 2010-01-22 01:06:59 | 
|  2 | centre    | center      | 2010-01-22 01:06:59 | 
|  3 | flavour   | flavor      | 2010-01-22 01:14:30 | 
|  4 | colour    | color       | 2010-01-22 01:14:30 | 
+----+-----------+-------------+---------------------+
4 rows in set (0.00 sec)

and turn them into this:

"id","word","replacement","created"
"1","favourite","favorite","2010-01-22 01:06:59"
"2","centre","center","2010-01-22 01:06:59"
"3","flavour","flavor","2010-01-22 01:14:30"
"4","colour","color","2010-01-22 01:14:30"

It can also convert the data into an HTML table if it’s going directly to the web. Please feel free to use my copy if it’s useful to you (everything is client-side JavaScript; nothing is sent to the server) or grab your own from the source.