{"id":1153,"date":"2020-11-25T14:01:00","date_gmt":"2020-11-25T14:01:00","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/11\/25\/4664722-how-to-import-a-database-over-ssh-on-cpanel-at-hostinger\/"},"modified":"2026-03-16T12:12:12","modified_gmt":"2026-03-16T12:12:12","slug":"4664722-how-to-import-a-database-over-ssh-on-cpanel-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4664722-how-to-import-a-database-over-ssh-on-cpanel-at-hostinger\/","title":{"rendered":"How to Import a Database Over SSH on cPanel at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">phpMyAdmin allows you to <b><a href=\"\/support\/4548519-how-to-import-a-database-with-phpmyadmin-on-cpanel\" target=\"_blank\" class=\"intercom-content-link\">import databases<\/a><\/b> up to <b>128 MB<\/b>; sometimes a little less, when the database has a large number of rows. If importing with phpMyAdmin failed, you can import your database using <b>SSH<\/b> by following these steps:<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"step-1---preparation\">Step 1 &ndash; Preparation<\/h2><ul>\n<li>\n<p class=\"no-margin\">Upload the database file in <b>.sql<\/b> format to your website&rsquo;s <b>public_html<\/b> folder. You can do so <b><a href=\"\/support\/1869164-how-to-upload-backup-with-ftp\" target=\"_blank\" class=\"intercom-content-link\">via FTP<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/4548533-how-can-i-create-a-new-mysql-database-in-cpanel\" target=\"_blank\" class=\"intercom-content-link\">Create a new database<\/a><\/b> or <b><a href=\"\/support\/4536290-how-to-delete-all-database-tables-in-phpmyadmin\" target=\"_blank\" class=\"intercom-content-link\">clear the one you plan to import into<\/a><\/b><\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">\n<\/p><h2 id=\"step-2---connecting\">Step 2 &ndash; Connecting via SSH<\/h2><ul>\n<li>\n<p class=\"no-margin\">Connect to your <b><a href=\"\/support\/4622295\" target=\"_blank\" class=\"intercom-content-link\">hosting via SSH<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">Use the <code>ls<\/code> command to ensure you are in the <b>root directory<\/b>, that is, <b>public_html<\/b>. If you are located in a different directory, use the <code>ls<\/code> and <code>cd<\/code> commands to reach it. For example, the process will be similar to this, replacing <b>domain.tld<\/b> with your domain name:<\/p>\n<\/li>\n<\/ul><pre><code>cd domains<br>cd domain.tld<br>cd public_html<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">If the database backup is displayed, go to the next step.<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">If you the backup file is missing, use the <b><a href=\"\/support\/4622321-basic-actions-in-cpanel-file-manager\" target=\"_blank\" class=\"intercom-content-link\">File Manager<\/a><\/b> to verify the file is correctly stored in the <b>public_html<\/b> folder<\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">\n<\/p><h2 id=\"step-3---import\">Step 3 &ndash; Import the Database<\/h2><p class=\"no-margin\">To <b>import the database<\/b>, use this command:<\/p><p class=\"no-margin\">\n<\/p><pre><code>mysql -u database_username -p database_name &lt; file.sql<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If the <b>parameters of your database<\/b> are:<\/p><ul>\n<li>\n<p class=\"no-margin\"><b>MySQL Database name<\/b>: user_database<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b>MySQL Username<\/b>: user_admin<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b>Uploaded database file:<\/b> database.sql<\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">The command will look like this:<\/p><p class=\"no-margin\">\n<\/p><pre><code>mysql -u user_admin -p user_database &lt; database.sql<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">After that you will need to <b>enter the database password<\/b> &ndash; the importing process will start immediately. The import will take some time depending on the size of your database. <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">When it is completed, a new line will appear:<\/p><p class=\"no-margin\">\n<\/p><pre><code>-bash-4.2$<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">This line means that the importing process is done, you will see your database tables in phpMyAdmin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Importing a database via SSH using cPanel<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[195],"tags":[],"class_list":["post-1153","post","type-post","status-publish","format-standard","hentry","category-mysql"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4664722-how-to-import-a-database-over-ssh-on-cpanel-at-hostinger\/","default":1},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4664722-comment-importer-une-base-de-donnees-par-ssh-sur-cpanel-a-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4664722-bagaimana-cara-mengimpor-database-melalui-ssh-di-cpanel-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4664722-como-faco-para-importar-um-banco-de-dados-por-ssh-no-cpanel\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1153"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1153\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}