{"id":595,"date":"2020-06-19T17:31:21","date_gmt":"2020-06-19T17:31:21","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=595"},"modified":"2020-06-19T17:31:21","modified_gmt":"2020-06-19T17:31:21","slug":"how-to-restore-mysql-database-using-ssh","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/how-to-restore-mysql-database-using-ssh.html","title":{"rendered":"How to Restore MySQL Database Using SSH"},"content":{"rendered":"\n<p>This would be a simple step by step post for the help of my customers. You require two tools for this. <\/p>\n\n\n\n<p>i) putty &#8211; ssh client<br>ii) WinSCP &#8211; File transfer client over SSH (You may use FTP or File manager as well)<\/p>\n\n\n\n<p>Once you download putty, open it, and use your server&#8217;s IP in the Host Name section:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"453\" height=\"441\" src=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/server_ip_putty.png\" alt=\"\" class=\"wp-image-596\" srcset=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/server_ip_putty.png 453w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/server_ip_putty-300x292.png 300w\" sizes=\"(max-width: 453px) 85vw, 453px\" \/><\/figure>\n\n\n\n<p>Now, click on open. In the prompt, type &#8216;root&#8217; as login as and enter. Then type the password and enter. If the password for the root is right, it will login to the command shell prompt or else it will put you in the authentication error console.<\/p>\n\n\n\n<p>Now, open WinSCP to login to your server using the same manner of SSH. Once done, transfer your sql file to the home directory of root. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"657\" height=\"439\" src=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_login.png\" alt=\"\" class=\"wp-image-597\" srcset=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_login.png 657w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_login-300x200.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption>Login to your server using WinSCP<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"281\" src=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-1024x281.png\" alt=\"\" class=\"wp-image-598\" srcset=\"https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-1024x281.png 1024w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-300x82.png 300w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-768x211.png 768w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-1536x421.png 1536w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer-1200x329.png 1200w, https:\/\/mellowhost.com\/blog\/wp-content\/uploads\/sites\/3\/2020\/06\/winscp_transfer.png 1842w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>WinSCP Transfer<\/figcaption><\/figure>\n\n\n\n<p>To transfer the file, navigate the sql file from your desktop on the left side and then drag it to the right side of WinSCP window. That will start the transfer. Remember the path of the destination on the server. Path is shown in the red marked area in the image. <\/p>\n\n\n\n<p>Once the file is transferred, come back to putty, and change directory to the path you had noted in WinSCP, in our case, it is \/root\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/root\/\nmysql -uusername -ppassword your_database_name &lt; your_sql_file_name.sql<\/pre>\n\n\n\n<p>Remember the following. Your mysql username should go right after &#8216;-u&#8217; <strong>without any space<\/strong> and the mysql password should be the same without space. Replace the &#8216;your_database_name&#8217; with your original database name in the server and &#8216;your_sql_file_name.sql&#8217; with the exact sql file name that you had uploaded. <\/p>\n\n\n\n<p>Now if you allow sometime, the command should complete after the restore. If it returns any error, you would need to attend them to do a complete restore. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This would be a simple step by step post for the help of my customers. You require two tools for this. i) putty &#8211; ssh clientii) WinSCP &#8211; File transfer client over SSH (You may use FTP or File manager as well) Once you download putty, open it, and use your server&#8217;s IP in the &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/how-to-restore-mysql-database-using-ssh.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Restore MySQL Database Using SSH&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[412,14],"tags":[414,87,438,270],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/595"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=595"}],"version-history":[{"count":1,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/595\/revisions"}],"predecessor-version":[{"id":599,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/595\/revisions\/599"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}