{"id":14512,"date":"2017-01-17T12:48:55","date_gmt":"2017-01-17T11:48:55","guid":{"rendered":"https:\/\/www.oderland.se\/support\/artikel\/hur-importerar-jag-en-databasbackup\/"},"modified":"2026-02-13T16:32:20","modified_gmt":"2026-02-13T15:32:20","slug":"how-do-i-import-a-database-backup","status":"publish","type":"ht_kb","link":"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-import-a-database-backup\/","title":{"rendered":"How do I import a database backup?"},"content":{"rendered":"\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">To restore a database from our automatic backup solution Acronis, please refer to <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-restore-backups-via-acronis-backup\/#how-to-restore-databases\" data-type=\"ht_kb\" target=\"_blank\">these instructions<\/a>.<\/p>\n\n\n\n<p>Sometimes, you need to import a database backup, <em>e.g.<\/em> from a previous provider. There are two ways to do this, and this guide will detail both methods. Keep in mind that you need to create a database to where the backup should be imported (if you&#8217;re not overwriting the content of an existing database). <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-create-databases-via-cpanel\/\" target=\"_blank\">These instructions<\/a> detail how you create a database.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-danger\">If you receive an error message stating <code>Access denied<\/code> even though you&#8217;ve entered correct credentials for the database, it may be because your database file contains a <code>CREATE DATABASE<\/code> statement. The error then arises because you cannot create databases from anywhere else than from cPanel. Make sure that your database file does not contain <code>CREATE DATABASE<\/code> statements.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">If you receive an error message regarding <code>Index column size too large<\/code>, edit your database file. Go to the row mentioned in the error message: you should find a <code>CREATE TABLE<\/code> statement there. Add <code>ROW_FORMAT=DYNAMIC<\/code> to it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">phpMyAdmin via cPanel<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Begin by <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-login-to-cpanel\/\" data-type=\"ht_kb\" data-id=\"4236\" target=\"_blank\">logging on to cPanel<\/a>.<\/li>\n\n\n\n<li>Then click the icon <code>phpMyAdmin<\/code> under <code>Databases<\/code>.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"193\" class=\"wp-image-24948\" style=\"width: 713px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1.png\" alt=\"\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1.png 713w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1-300x81.png 300w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1-50x14.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1-60x16.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/05\/cpanel_icon_phpmyadmin-1-100x27.png 100w\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" \/><\/a><\/li>\n\n\n\n<li>Once you\u2019ve entered phpMyAdmin, you will see a list of your databases to the left. Click the one to which you\u2019d like to import your backup.<\/li>\n\n\n\n<li>Now, in the menu at the top of the page, click the tab <code>Import<\/code>.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_tab.png\"><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"40\" class=\"wp-image-14516\" style=\"width: 312px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_tab.png\" alt=\"\"><\/a><\/li>\n\n\n\n<li>Click <code>Browse<\/code> and select the SQL file you wish to import.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_browse.png\"><img loading=\"lazy\" decoding=\"async\" width=\"541\" height=\"182\" class=\"wp-image-14520\" style=\"width: 541px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_browse.png\" alt=\"\"><\/a><\/li>\n\n\n\n<li>Select <code>SQL<\/code> as format, if it&#8217;s a SQL file you&#8217;re about to import. Finally, click <code>Go<\/code> at the bottom of the page.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_format.png\"><img loading=\"lazy\" decoding=\"async\" width=\"246\" height=\"95\" class=\"wp-image-14522\" style=\"width: 246px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/phpmyadmin_import_format.png\" alt=\"\"><\/a><\/li>\n<\/ol>\n\n\n\n<p>If your database file is larger than 200MB, you will not be able to import it via phpMyAdmin. If it too large, try compressing it and see if it becomes smaller than 200MB. If it&#8217;s still too large, you need to import it via SSH instead (use the uncompressed file), please read the instructions below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Via SSH<\/h2>\n\n\n\n<p>Begin by uploading your SQL file to your account. You may use the <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-use-the-file-manager-in-cpanel\/#upload-a-file\" target=\"_blank\" rel=\"noreferrer noopener\">File Manager<\/a> found via cPanel for this purpose.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-danger\">Do not upload the file to a folder reachable via the Internet. If you do, anyone could download the database file. Instead, upload it to <em>e.g.<\/em> the document root of the web hosting account.<\/p>\n\n\n\n<p>Then you need to connect to your web hosting account via SSH to run the import command below. <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-connect-to-my-web-hosting-account-using-ssh\/\" data-type=\"ht_kb\" data-id=\"4832\" target=\"_blank\" rel=\"noreferrer noopener\">This guide<\/a> describes how you access your account via SSH.<\/p>\n\n\n\n<p>Finally, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mariadb -u username -p dbname &lt; path\/to\/databasebackup.sql<\/pre>\n\n\n\n<p>Replace <code>username<\/code> with the database username,  <code>dbname<\/code> with the name of the database, and enter the correct path to where you have uploaded the database file. You will then be prompted for the database user&#8217;s password.<\/p>\n\n\n\n<p>Keep in mind that the database to where the backup should be imported (if you&#8217;re not overwriting an existing one) have to exist before you begin. <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-create-databases-via-cpanel\/\" target=\"_blank\">These instructions<\/a> detail how you create a database and database user via cPanel.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you need to import a database backup, e.g. from a previous provider. There are two ways to do this, and this guide will detail both methods. Keep in mind that you need to create a database to where the backup should be imported (if you&#8217;re not overwriting the content&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"ht-kb-category":[194],"ht-kb-tag":[],"class_list":["post-14512","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-backup-and-restore"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/14512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/comments?post=14512"}],"version-history":[{"count":26,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/14512\/revisions"}],"predecessor-version":[{"id":24955,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/14512\/revisions\/24955"}],"wp:attachment":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/media?parent=14512"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-category?post=14512"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=14512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}