If hPanel’s restore keeps timing out, or your backup came from somewhere else and is too big for a web upload, you can restore a WordPress backup manually over SSH on Hostinger. You extract the files with tar or unzip, import the database with WP-CLI, then fix permissions and caches. This guide walks through each command and shows how to check it worked.
Quick answer: Turn on SSH in hPanel, move the broken site aside, extract your backup into public_html, then reset the database and import your SQL dump with WP-CLI.
- Enable SSH in hPanel and connect on port 65002.
- Move the broken files out of
public_html. - Extract the backup archive into
public_html. - Check the database details and table prefix in
wp-config.php. - Export, reset and import the database with
wp db import. - Run
wp search-replaceif the URL changed, fix permissions and purge the cache.
In this guide
- Before You Start
- Step 1: Enable SSH and Put the Backup Files on the Server
- Step 2: Move the Broken Site Out of public_html
- Step 3: Extract the Backup Files
- Step 4: Check the Database Details in wp-config.php
- Step 5: Reset and Import the Database
- Step 6: Update the Site URL If the Domain Changed
- Step 7: Fix File Permissions and Clear the Cache
- Common Restore Problems on Hostinger
- Frequently Asked Questions
- Next Steps

Before You Start
- Access: your hPanel login, and the database name, user and password for the site (from hPanel’s MySQL databases page).
- Backup files: a files archive (
.tar.gzor.zip) and a database dump (.sqlor.sql.gz). - Disk space: room for the archive, the extracted files and a copy of the current site. Check your usage in hPanel first.
- Time: 30–60 minutes for most sites. The site is offline from Step 2 until the import finishes.
- Safety net: Steps 2 and 5 keep copies of the current files and database. Do not skip them; they are your way back if the backup turns out to be bad.
Step 1: Enable SSH and Put the Backup Files on the Server
On Hostinger’s shared and Cloud plans, SSH is off by default. In hPanel, go to Advanced > SSH Access and switch it to Enabled. Note the connection details on that screen:
- SSH IP / Host: your server IP address (for example
203.0.113.10) - SSH Port: Hostinger uses port
65002instead of the default port 22 - SSH Username: your account username (for example
u123456789) - SSH Password: the password set on the SSH Access page (by default the same as your FTP password), or your uploaded SSH key
Connect from your local terminal with that port. Hostinger’s own SSH documentation covers SSH keys and Windows clients:
ssh -p 65002 u123456789@203.0.113.10When the login works, your prompt changes to show your Hostinger username. Your live site is in domains/yourdomain.com/public_html. Put the backup archive and the database dump in the folder just above it, domains/yourdomain.com, so they are not downloadable from the web.
If the backup is on another server or in cloud storage, download it straight to Hostinger over SSH instead of uploading it from your computer:
cd ~/domains/yourdomain.com
wget https://backups.example.com/site-backup.tar.gz
wget https://backups.example.com/db-backup.sql.gzwget shows a progress bar for each file and ends with a “saved” line. Run ls -lh to see both files and their sizes.
Step 2: Move the Broken Site Out of public_html
Do not extract a backup on top of a broken install. Leftover plugin files, orphaned scripts or malware stay behind and can break the restored site.
First check how much space the current files use with du -sh public_html, and compare it with the remaining quota in hPanel. Then move the broken site into a separate folder, still on the server, so you can go back to it if you need to:
cd ~/domains/yourdomain.com
# Move the broken install (including dotfiles) out of the web root rather than deleting it
mkdir public_html_broken
find public_html -mindepth 1 -maxdepth 1 -exec mv -t public_html_broken {} +ls -A public_html should now print nothing, because the folder is empty.
If you are short on disk space and nothing in the old site is worth keeping, you can delete its contents instead. This cannot be undone:
cd ~/domains/yourdomain.com/public_html && rm -rf ./* ./.htaccessStep 3: Extract the Backup Files
With public_html empty, extract your archive into it. For a .tar.gz file:
tar -xzvf ~/domains/yourdomain.com/site-backup.tar.gz -C ~/domains/yourdomain.com/public_html/The v flag lists each file as it is extracted. For a .zip archive (from UpdraftPlus, Duplicator or cPanel, for example), use unzip with -q so it does not print tens of thousands of lines:
unzip -q ~/domains/yourdomain.com/site-backup.zip -d ~/domains/yourdomain.com/public_html/Some archives wrap everything in an extra folder, such as public_html/wordpress/. If yours does, move the files up one level so WordPress sits directly in public_html (change wordpress to your folder’s name):
cd ~/domains/yourdomain.com/public_html
shopt -s dotglob # also match hidden files such as .htaccess
mv wordpress/* ./
shopt -u dotglob
rmdir wordpressRun ls ~/domains/yourdomain.com/public_html to check. You should see index.php, wp-config.php, wp-content, wp-admin and wp-includes directly inside it.
Step 4: Check the Database Details in wp-config.php
The restored wp-config.php may still point to an old host, a local setup or a deleted database user. The database name, user and password must match the database that exists in hPanel now.
Open the file in the nano editor:
nano ~/domains/yourdomain.com/public_html/wp-config.phpFind these lines and change the values to your current Hostinger database:
// ** MySQL settings - You can get this info from your web host ** //
define( 'DB_NAME', 'u123456789_wpdb' );
define( 'DB_USER', 'u123456789_wpusr' );
define( 'DB_PASSWORD', 'YourSuperSecretPasswordHere123!' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );Check the table prefix too. If your SQL dump uses wp_ but wp-config.php says wp_staging_, WordPress shows a fresh install screen instead of your content. Scroll down to find this line:
$table_prefix = 'wp_';Press Ctrl + O and Enter to save, then Ctrl + X to close nano.
Step 5: Reset and Import the Database
Clear the existing tables before you import. Tables created by plugins after the backup was taken would otherwise stay behind, and a dump without DROP TABLE lines would fail with duplicate-key errors. Importing over SSH also avoids the web timeouts that phpMyAdmin hits; for very large dumps, see how to import a large WordPress database via SSH.
Hostinger has WP-CLI installed, so this takes three commands, run from the WordPress root. wp db reset permanently drops every table, which is why the block saves a copy first. If your host refuses the reset with an access-denied error, use wp db clean --yes instead, which drops only the tables that use your table prefix:
cd ~/domains/yourdomain.com/public_html
# Keep a copy of the current database before wiping it
wp db export ~/domains/yourdomain.com/pre-restore.sql
# Drop all existing tables
wp db reset --yes
# Import the uncompressed SQL dump
wp db import ~/domains/yourdomain.com/db-backup.sqlEach command ends with a Success: line. If your dump is compressed as .sql.gz, stream it into WP-CLI instead of the last command:
gunzip < ~/domains/yourdomain.com/db-backup.sql.gz | wp db import -If you prefer the MySQL command-line client, do not put the password on the command line, where it ends up in your shell history and the process list. Pass -p on its own and type the password when asked:
mysql -u u123456789_wpusr -p u123456789_wpdb < ~/domains/yourdomain.com/db-backup.sqlTo check the import, run wp db size --tables. You should see your WordPress tables listed with sizes similar to the original site.
Step 6: Update the Site URL If the Domain Changed
Skip this step if the backup came from the same domain. If it came from a staging site, a local domain (like mysite.local) or an old http:// address, the site will redirect to the old URL or load broken assets.
Do not edit the SQL file with a text editor’s find-and-replace. WordPress stores many settings as PHP serialized data, which records the length of each string, so a plain replace corrupts widgets and theme settings. WP-CLI’s search-replace command updates those lengths for you. Start with a dry run:
cd ~/domains/yourdomain.com/public_html
wp search-replace 'https://staging.yourdomain.com' 'https://yourdomain.com' --all-tables --precise --dry-runThe dry run shows how many replacements each table would get, without changing anything. If the counts look right, run it for real:
wp search-replace 'https://staging.yourdomain.com' 'https://yourdomain.com' --all-tables --preciseFor more options and how to check the result, see the full guide to updating URLs after a migration with WP-CLI search-replace.
Step 7: Fix File Permissions and Clear the Cache
Extracting archives over SSH can leave file permissions wrong. Hostinger’s web server expects folders set to 755 and files set to 644.
Run these commands from inside public_html:
cd ~/domains/yourdomain.com/public_html
# Set folder permissions to 755
find . -type d -exec chmod 755 {} +
# Set file permissions to 644
find . -type f -exec chmod 644 {} +
# Secure wp-config.php with tighter permissions
chmod 640 wp-config.phpThey print nothing when they work. Hostinger runs LiteSpeed Web Server, and old object cache entries or cached pages keep serving old redirects or broken styling until you clear them:
# Flush the WordPress object cache
wp cache flush
# Purge the LiteSpeed page cache (only if the LiteSpeed Cache plugin is active)
wp litespeed-purge allwp cache flush confirms with a Success: line. The purge command only works if the LiteSpeed Cache plugin is active.
Common Restore Problems on Hostinger
Manual restores often hit one of these problems on the first attempt.
1. MySQL Server Has Gone Away (Error 2006)
If your database has very large rows, such as big WooCommerce logs or page-builder revisions, the import can stop with ERROR 2006 (HY000) at line 842: MySQL server has gone away. One SQL statement was larger than the server’s packet limit.
Raise the limit for the import by adding --max_allowed_packet:
mysql --max_allowed_packet=512M -u u123456789_wpusr -p u123456789_wpdb < ~/domains/yourdomain.com/db-backup.sql2. Disk or Inode Limit Reached During Extraction
Hostinger limits both disk space and inodes (the number of files). If extraction stops with tar: write error: No space left on device, you have reached one of them.
On shared hosting, df -h reports the whole server’s disk rather than your quota, so check your own usage and file count instead, and compare them with the limits in hPanel:
du -sh ~/domains/yourdomain.com/*
find ~/domains/yourdomain.com | wc -lDelete the archive (site-backup.tar.gz) once it is extracted, and clear old logs such as wp-content/debug.log, before you try again.
3. PHP Memory Limit Reached in WP-CLI
If wp search-replace or wp cache flush stops with Fatal error: Allowed memory size of X bytes exhausted, WP-CLI is running with a low memory limit.
Raise the limit for that one command:
php -d memory_limit=512M $(which wp) search-replace 'https://oldurl.com' 'https://newurl.com' --all-tables4. “Error Establishing a Database Connection”
The details in wp-config.php do not match a database user that exists on Hostinger. Check them again against hPanel (Step 4). If they look right, see how to fix “Error establishing a database connection” on Hostinger.
Frequently Asked Questions
Should I use hPanel’s restore or SSH?
Use hPanel’s restore first if the backup is one Hostinger made. It is simpler and needs no commands. Restore over SSH when the hPanel restore keeps failing, when the backup came from another host or a plugin, or when the archive is too large to upload through a browser.
Can I restore a WordPress backup if I only have the wp-content folder?
Yes. Put a fresh copy of the WordPress core files in public_html, replace its wp-content folder with your backup, import your database dump and set up wp-config.php. WordPress core files contain no site-specific data, so nothing is lost.
Why does my site show a 403 Forbidden error after an SSH restore?
Usually because of wrong permissions or a missing file. Check that index.php and .htaccess are in public_html, and run the permission commands from Step 7 so every folder is 755 and every file is 644.
Next Steps
- Open the site in a private browser window and log in at
/wp-login.php. - Upload a test image in the Media Library to confirm permissions work.
- Once you are happy, delete
public_html_broken,pre-restore.sqland the backup files from the server to free space. - Set up scheduled backups so the next restore is easier: automate WordPress backups with WP-CLI and cron on Hostinger.

