{"id":9710,"date":"2025-03-14T08:29:01","date_gmt":"2025-03-14T08:29:01","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=9710"},"modified":"2025-03-14T09:29:01","modified_gmt":"2025-03-14T09:29:01","slug":"update-mysql-table-through-csv-via-command-line-on-macos","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/my-cmd\/update-mysql-table-through-csv-via-command-line-on-macos.html","title":{"rendered":"Update MySQL table through CSV via command line on MacOS"},"content":{"rendered":"<p>Want to import  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comma-separated_values\">CSV<\/a>  to update rows in  <a href=\"https:\/\/www.mysql.com\/\">MySQL<\/a>  table via command line on MacOS?<\/p>\n<p>Using <a href=\"https:\/\/www.withdata.com\/my-cmd\/\">my-cmd<\/a>, a Command-Line client for MySQL, you can import CSV\/TSV\/TXT data to update existing MySQL  (MariaDB, Percona) table easily and fast.<\/p>\n<p>Support Windows, Linux, and MacOS.<\/p>\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><br \/>\n<\/span><\/p>\n<p>No need to install MySQL client library.<\/p>\n<p>Convenient to deploy to cloud. No need to run installation file, just uncompress and run, immediately.<\/p>\n<h2>Update MySQL  (MariaDB, Percona) table through CSV\/TSV\/TXT file via command line on MacOS<\/h2>\n<p>1. In interactive mode:<\/p>\n<pre>\nmy-cmd> load loadtype=update\n      > updatekey=id\n      > table=media_messages \n      > datafile=\/Users\/pan\/Documents\/media_messages.csv \n      > delimiter=, \n      > quote=\" \n      > header=y;\n<\/pre>\n<p>2. In batch mode:<\/p>\n<pre>\nmy-cmd dsn=\"pan:withdata@192.168.0.102\/test\" task=load loadtype=update updatekey=id table=media_messages datafile=\/Users\/pan\/Documents\/media_messages.csv delimiter=, quote=\" header=y quit=y\n<\/pre>\n<p>&#8220;loadtype=update&#8221; will update row in table by &#8220;updatekey&#8221; id, not insert.<\/p>\n<p>See <a href=\"https:\/\/www.withdata.com\/my-cmd\/load.html\">parameters detail<\/a>.<\/p>\n<hr style=\"clear: both;\" \/>\n<p><a href=\"https:\/\/www.withdata.com\/my-cmd\/\">More about my-cmd<\/a> &#8211; <a href=\"https:\/\/www.withdata.com\/my-cmd\/\">Command-Line client 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><br \/>\n<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Want to import CSV to update rows in MySQL table via command line on MacOS? Using my-cmd, a Command-Line client for MySQL, you can import CSV\/TSV\/TXT data to update existing MySQL (MariaDB, Percona) table easily and fast. Support Windows, Linux, and MacOS. Download my-cmd MacOS version my-cmd.darwin-amd64.zip my-cmd.darwin-arm64.zip No need to install MySQL client library. [&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,34,2554,1323,2562,2561],"class_list":["post-9710","post","type-post","status-publish","format-standard","hentry","category-my-cmd","tag-command-line","tag-csv","tag-macos","tag-mysql","tag-mysql-update-csv","tag-update"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/9710","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=9710"}],"version-history":[{"count":4,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/9710\/revisions"}],"predecessor-version":[{"id":27309,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/9710\/revisions\/27309"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=9710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=9710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=9710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}