{"id":40008,"date":"2025-09-05T08:47:57","date_gmt":"2025-09-05T08:47:57","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=40008"},"modified":"2025-09-05T08:47:57","modified_gmt":"2025-09-05T08:47:57","slug":"export-data-from-mysql-to-json-via-command-line-on-macos","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/my-cmd\/export-data-from-mysql-to-json-via-command-line-on-macos.html","title":{"rendered":"Export data from MySQL to JSON via command line on MacOS"},"content":{"rendered":"<p>Want to export  <a href=\"https:\/\/www.mysql.com\/\">MySQL<\/a>  data to <a href=\"https:\/\/jsonlines.org\/\">JSON Lines (JSONL)<\/a> file via Command Line Interface (CLI) on MacOS?<\/p>\n<p>Using <a href=\"https:\/\/www.withdata.com\/my-cmd\/\">my-cmd<\/a>, Command Line Interface (CLI) client for MySQL, you can unload MySQL  (MariaDB, Percona) data to JSON easily and fast. Direct Interaction or Scripting and Automation.<\/p>\n<ul>\n<li>No need to install MySQL client library.<\/li>\n<li>Convenient to deploy to cloud. No need to run installation file, just uncompress and run, immediately.<\/li>\n<li>Commands are entered into a terminal or command prompt, accessed from local or remote (like SSH).<\/li>\n<li>Support Windows, Linux, and MacOS.<\/li>\n<\/ul>\n<p><a href=\"#download-top\" onclick=\"dtv.style.display = 'block';\">Download my-cmd Macos version<\/a>  <a href=\"#download-top\" onclick=\"dtv.style.display = 'block';\"><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/download_3.jpg\" alt=\"Download my-cmd\" width=\"80\" height=\"22\" style=\"max-width:100%;height:auto;\" \/><\/a> <span id=\"dtv\" style=\"display: none;\"><br \/>\n<a href=\"\/down\/my-cmd.darwin-amd64.zip\">my-cmd.darwin-amd64.zip<\/a><br \/>\n<a href=\"\/down\/my-cmd.darwin-arm64.zip\">my-cmd.darwin-arm64.zip<\/a><\/p>\n<p><\/span><\/p>\n<h2>Export MySQL  (MariaDB, Percona) data to JSON via command line on MacOS<\/h2>\n<p><b>1. Unload Table.<\/b><\/p>\n<p>1) In interactive mode:<\/p>\n<pre>\nmy-cmd> unload table=jobs datafile=e:\\temp\\tables\\jobs.json filetype=json;\n<\/pre>\n<p>2) In batch mode:<\/p>\n<pre>\nmy-cmd dsn=\"pan:withdata@192.168.0.102\/test\" task=unload table=jobs datafile=e:\\temp\\tables\\jobs.json filetype=json quit=y\n<\/pre>\n<p><b>2. Unload Query.<\/b><\/p>\n<p>1) In interactive mode:<\/p>\n<pre>\nmy-cmd> unload query=\"select job_id,job_title from jobs\"\n     >  datafile=e:\\temp\\tables\\jobs_part.json\n     >  filetype=json;\n<\/pre>\n<p>2) In batch mode:<\/p>\n<pre>\nmy-cmd dsn=\"pan:withdata@192.168.0.102\/test\" task=unload query=\"select job_id,job_title from jobs\" datafile=e:\\temp\\tables\\jobs_part.json filetype=json quit=y\n<\/pre>\n<p><b>3. Unload All Tables.<\/b><\/p>\n<p>1) In interactive mode:<\/p>\n<pre>\nmy-cmd> unload table=all folder=e:\\temp\\tables filetype=json;\n<\/pre>\n<p>2) In batch mode:<\/p>\n<pre>\nmy-cmd dsn=\"pan:withdata@192.168.0.102\/test\" task=unload table=all folder=e:\\temp\\tables filetype=json quit=y\n<\/pre>\n<p>See <a href=\"https:\/\/www.withdata.com\/my-cmd\/unload.html\">parameters detail<\/a>.<\/p>\n<hr style=\"clear: both;\" \/>\n<p>More about <a href=\"https:\/\/www.withdata.com\/my-cmd\/\">my-cmd &#8211; Command Line Interface (CLI) tool for MySQL<\/a><\/p>\n<div id=\"download-bottom\" style=\"clear: both;\">\n<p>Download my-cmd Macos version<a href=\"#download-bottom\" onclick=\"dbv.style.display = 'block';\"><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/btn_download_green.png\" alt=\"Download my-cmd\" width=\"165\" height=\"50\" style=\"max-width:100%;height:auto;\" \/><\/a> <span id=\"dbv\" style=\"display: none;\"><br \/>\n<a href=\"\/down\/my-cmd.darwin-amd64.zip\">my-cmd.darwin-amd64.zip<\/a><br \/>\n<a href=\"\/down\/my-cmd.darwin-arm64.zip\">my-cmd.darwin-arm64.zip<\/a><\/p>\n<p><\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Want to export MySQL data to JSON Lines (JSONL) file via Command Line Interface (CLI) on MacOS? Using my-cmd, Command Line Interface (CLI) client for MySQL, you can unload MySQL (MariaDB, Percona) data to JSON easily and fast. Direct Interaction or Scripting and Automation. No need to install MySQL client library. Convenient to deploy to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2552],"tags":[73,16,1418,2554,1323,1552],"class_list":["post-40008","post","type-post","status-publish","format-standard","hentry","category-my-cmd","tag-command-line","tag-export","tag-json","tag-macos","tag-mysql","tag-mysql-export-json"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=40008"}],"version-history":[{"count":1,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40008\/revisions"}],"predecessor-version":[{"id":40009,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40008\/revisions\/40009"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=40008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=40008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=40008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}