{"id":18433,"date":"2026-09-30T07:34:05","date_gmt":"2026-09-30T04:34:05","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/import-mysql-database-ssh\/"},"modified":"2026-09-30T07:34:05","modified_gmt":"2026-09-30T04:34:05","password":"","slug":"import-mysql-database-ssh","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/import-mysql-database-ssh\/","title":{"rendered":"How to Import a Large MySQL Database over SSH"},"content":{"rendered":"<div class=\"hy-tldr\" style=\"background:#f6f7fb;border-left:4px solid #d83954;border-radius:10px;padding:14px 18px;margin:0 0 20px;line-height:1.8\"><strong>In short:<\/strong> To import a large database over SSH: upload the .sql file to the server, create a database and a user (CREATE DATABASE, CREATE USER, GRANT ALL PRIVILEGES), then run mysql -u USER -p DBNAME &lt; file.sql and enter the password. This is faster than phpMyAdmin for large files.<\/div>\n<p>Large databases are hard to import through phpMyAdmin because of upload size and time limits. On a server without a control panel you also need the command line. Here is how to import a database over SSH.<\/p>\n<p><strong>1.<\/strong> Connect to your server over SSH (see <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/how-to-connect-to-a-server-via-ssh\/\">how to connect to your server over SSH<\/a>).<\/p>\n<p><strong>2.<\/strong> Upload your .sql file to the server, for example with SFTP.<\/p>\n<p><strong>3.<\/strong> Create an empty database and a user, and give the user privileges on it. Log in as root and enter the MySQL root password:<\/p>\n<pre>mysql -u root -p<\/pre>\n<pre>CREATE DATABASE hyyat;\nCREATE USER 'hyyat'@'localhost' IDENTIFIED BY 'password';\nGRANT ALL PRIVILEGES ON hyyat.* TO 'hyyat'@'localhost';\nFLUSH PRIVILEGES;\nexit<\/pre>\n<p>Here the database and user are both named hyyat. Use your own names and a strong password.<\/p>\n<p><strong>4.<\/strong> Go to the folder with your .sql file and import it:<\/p>\n<pre>mysql -u hyyat -p hyyat &lt; hyyat123.sql<\/pre>\n<p>Enter the user&#8217;s password when asked, and wait until the command finishes. The -p option without a value asks for the password, so it does not appear in your shell history.<\/p>\n<p>See also <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/mysql-commands-ssh\/\">basic MySQL commands over SSH<\/a> and <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/import-export-mysql-database-phpmyadmin\/\">how to import and export a database with phpMyAdmin<\/a>.<\/p>\n<p class=\"hy-svc-link\" style=\"background:#fff5f7;border-left:4px solid #d83954;border-radius:10px;padding:14px 18px;margin:20px 0;line-height:1.8\"><strong>Related service:<\/strong> <a href=\"https:\/\/www.hyyat.com\/en\/server-management\/\">Hyyat Host server management<\/a> can migrate and import large databases for you, with 24\/7 support.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In short: To import a large database over SSH: upload the .sql file to the server, create a database and a user (CREATE DATABASE, CREATE USER, GRANT ALL PRIVILEGES), then run mysql -u USER -p DBNAME &lt; file.sql and enter the password. This is faster than phpMyAdmin for large files. Large databases are hard to [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_templately_pack_id":"","_templately_imported_at":"","_templately_source":"","_templately_import_session_id":"","footnotes":""},"doc_category":[2733],"doc_tag":[],"class_list":["post-18433","docs","type-docs","status-publish","hentry","doc_category-servers-without-control-panel"],"year_month":"2026-10","word_count":260,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"ahmed fathy","author_nicename":"ahmed-fathy","author_url":"https:\/\/www.hyyat.com\/en\/author\/ahmed-fathy\/"},"doc_category_info":[{"term_name":"servers without control panel","term_url":"https:\/\/www.hyyat.com\/en\/kb\/servers-without-control-panel\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/comments?post=18433"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18433\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=18433"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=18433"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=18433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}