{"id":489,"date":"2019-02-14T04:04:13","date_gmt":"2019-02-14T04:04:13","guid":{"rendered":"http:\/\/www.projectimmerse.com\/blog\/?p=489"},"modified":"2020-06-17T06:02:12","modified_gmt":"2020-06-17T06:02:12","slug":"importing-sql-database-using-the-command-line","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/","title":{"rendered":"Importing sql database using the command line"},"content":{"rendered":"<p>This is definitely worth a post. Just when I want to disregard this utility as trivial &#8211; every now and then I get a consulting gig where I need to run a full backup &#8211; yes of everything, files, database, the works. You see, sometimes I get a task that isn&#8217;t as black and white as it may seem at first glance &#8211; something is a bit unconventional, but you know &#8211; there is nothing wrong with that. Sites come in all shapes and sizes, in all sorts of architectures. It&#8217;s good to get exposed to a variety even really weird ones. Look I&#8217;d rather poke around a dev site over production no matter how tempting it is &#8211; I&#8217;ve seen way too many sites go down in my life time, it&#8217;s not worth the gamble. I tell every junior developer &#8211; the first thing you should do is create a back up. First thing you should do. Then you can show off your programming skills later and you know &#8211; be that &#8220;rockstar&#8221; developer you were meant to be. <\/p>\n<p><!--more--><\/p>\n<p>So this one isn&#8217;t that weird, just a good example of where I had to use the import utility via the command line. I figure it would be a good time to showcase this powerful tool. <\/p>\n<p>So if you ever run into a situation where you are importing a gigantic sql file that either (1) results in a connection time out or (2) gateway error, or (3) some error that didn&#8217;t result in the a successful import &#8211; here&#8217;s what you need to know:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n$ mysql -h mysql.example.com -u username -p dbname &lt; databasefile.sql\r\n\r\n<\/pre>\n<p>Yup this will work &#8211; you&#8217;ve successfully imported the database through the command line. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is definitely worth a post. Just when I want to disregard this utility as trivial &#8211; every now and then I get a consulting gig where I need to run a full backup &#8211; yes of everything, files, database, the works. You see, sometimes I get a task that isn&#8217;t as black and white &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Importing sql database using the command line&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1146,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-489","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Importing sql database using the command line - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Importing sql database using the command line - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"This is definitely worth a post. Just when I want to disregard this utility as trivial &#8211; every now and then I get a consulting gig where I need to run a full backup &#8211; yes of everything, files, database, the works. You see, sometimes I get a task that isn&#8217;t as black and white &hellip; Continue reading &quot;Importing sql database using the command line&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-14T04:04:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-17T06:02:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"projectimmerse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"projectimmerse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/\"},\"author\":{\"name\":\"projectimmerse\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"Importing sql database using the command line\",\"datePublished\":\"2019-02-14T04:04:13+00:00\",\"dateModified\":\"2020-06-17T06:02:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/\"},\"wordCount\":305,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/importing-sql-database-using-command-line.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/\",\"name\":\"Importing sql database using the command line - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/importing-sql-database-using-command-line.png\",\"datePublished\":\"2019-02-14T04:04:13+00:00\",\"dateModified\":\"2020-06-17T06:02:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/importing-sql-database-using-command-line.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/importing-sql-database-using-command-line.png\",\"width\":750,\"height\":750,\"caption\":\"Importing sql database using the command line\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/importing-sql-database-using-the-command-line\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Importing sql database using the command line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"projectimmerse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"caption\":\"projectimmerse\"},\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Importing sql database using the command line - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/","og_locale":"en_US","og_type":"article","og_title":"Importing sql database using the command line - Project Immerse","og_description":"This is definitely worth a post. Just when I want to disregard this utility as trivial &#8211; every now and then I get a consulting gig where I need to run a full backup &#8211; yes of everything, files, database, the works. You see, sometimes I get a task that isn&#8217;t as black and white &hellip; Continue reading \"Importing sql database using the command line\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/","og_site_name":"Project Immerse","article_published_time":"2019-02-14T04:04:13+00:00","article_modified_time":"2020-06-17T06:02:12+00:00","og_image":[{"width":750,"height":750,"url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png","type":"image\/png"}],"author":"projectimmerse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"projectimmerse","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/"},"author":{"name":"projectimmerse","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"Importing sql database using the command line","datePublished":"2019-02-14T04:04:13+00:00","dateModified":"2020-06-17T06:02:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/"},"wordCount":305,"commentCount":0,"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/","url":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/","name":"Importing sql database using the command line - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#primaryimage"},"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png","datePublished":"2019-02-14T04:04:13+00:00","dateModified":"2020-06-17T06:02:12+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#primaryimage","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/importing-sql-database-using-command-line.png","width":750,"height":750,"caption":"Importing sql database using the command line"},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/importing-sql-database-using-the-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Importing sql database using the command line"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"projectimmerse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","caption":"projectimmerse"},"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=489"}],"version-history":[{"count":3,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/489\/revisions"}],"predecessor-version":[{"id":1147,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/489\/revisions\/1147"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media\/1146"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}