{"id":598,"date":"2019-09-12T12:21:44","date_gmt":"2019-09-12T12:21:44","guid":{"rendered":"https:\/\/mellicloud.com\/?p=598"},"modified":"2019-09-12T12:21:44","modified_gmt":"2019-09-12T12:21:44","slug":"import-export-mysql-database","status":"publish","type":"post","link":"https:\/\/mellicloud.com\/en\/tutorial\/import-export-mysql-database\/598\/","title":{"rendered":"Import \/ Export MySQL Database (BIG DB)"},"content":{"rendered":"<div class=\"entry-content\">\n<p dir=\"ltr\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-599\" src=\"https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png\" alt=\"Import-Export-MySQL-Database\" width=\"370\" height=\"208\" srcset=\"https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png 370w, https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database-300x169.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>How to import or export MySQL database with command line.<\/strong><br \/>\n<em>This is also useful when working with big databases.<\/em><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>Export database info file<\/strong><\/p>\n<pre dir=\"ltr\">mysqldump DATABASE-NAME &gt; FILE-NAME.sql<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>Export database into compressed file to save space<\/strong><\/p>\n<pre dir=\"ltr\">mysqldump DATABASE-NAME | gzip FILE-NAME.sql.gz<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>Export database into compressed file with date name to save space<\/strong><\/p>\n<pre dir=\"ltr\">mysqldump DATABASE-NAME | gzip &gt; \"FILE-NAME_`date +%e_%b_%Y`.sql.gz\"<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>Import database<\/strong><\/p>\n<pre dir=\"ltr\">mysql DATABASE-NAME &lt; FILE-NAME.sql\r\nmysql mojtest_test1 &lt; mojtest_test1.sql<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>Import compressed database .gz file<\/strong><\/p>\n<pre dir=\"ltr\">gunzip FILE-NAME.sql.gz\r\nmysql DATABASE-NAME &lt; FILE-NAME.sql\r\nmysql mojtest_test1 &lt; mojtest_test1.sql<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>How to create MySQL\/MariaDB database and user<\/strong><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">For importing very big databases maybe you will also need to add this into <strong>\/etc\/my.cnf.d\/server.cnf <\/strong>under <strong>[mysqld]<\/strong><\/p>\n<pre dir=\"ltr\">wait_timeout = 86400\r\nmax_allowed_packet=256M\r\n<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\"><strong>phpMyAdmin (MySQL Database manager)<\/strong><br \/>\nphp server configuration: \/usr\/local\/cwp\/php71\/php.ini<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to import or export MySQL database with command line. This is also useful when working with big databases. Export database info file mysqldump DATABASE-NAME &gt; FILE-NAME.sql Export database into compressed file to save space mysqldump DATABASE-NAME | gzip FILE-NAME.sql.gz Export database into compressed file with date name to save space mysqldump DATABASE-NAME | gzip &hellip;<\/p>","protected":false},"author":1,"featured_media":599,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[68,62],"tags":[74,71,73,72],"class_list":["post-598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cwp","category-tutorial","tag-cwp","tag-import-big-database","tag-73","tag-72"],"uagb_featured_image_src":{"full":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"thumbnail":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database-150x150.png",150,150,true],"medium":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database-300x169.png",300,169,true],"medium_large":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"large":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"1536x1536":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"2048x2048":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"trp-custom-language-flag":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",18,10,false],"jannah-image-small":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database-220x150.png",220,150,true],"jannah-image-large":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false],"jannah-image-post":["https:\/\/mellicloud.com\/main\/wp-content\/uploads\/2019\/09\/Import-Export-MySQL-Database.png",370,208,false]},"uagb_author_info":{"display_name":"Admin","author_link":"https:\/\/mellicloud.com\/en\/author\/admin3207\/"},"uagb_comment_info":0,"uagb_excerpt":"How to import or export MySQL database with command line. This is also useful when working with big databases. Export database info file mysqldump DATABASE-NAME &gt; FILE-NAME.sql Export database into compressed file to save space mysqldump DATABASE-NAME | gzip FILE-NAME.sql.gz Export database into compressed file with date name to save space mysqldump DATABASE-NAME | gzip&hellip;","_links":{"self":[{"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/posts\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/comments?post=598"}],"version-history":[{"count":1,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/posts\/598\/revisions\/600"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/media\/599"}],"wp:attachment":[{"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/media?parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/categories?post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellicloud.com\/en\/wp-json\/wp\/v2\/tags?post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}