How you import a .sql file depends on your service.

Shared web hosting and WordPress hosting: phpMyAdmin

SSH is not open on our shared hosting server at the moment, so import the file with phpMyAdmin in cPanel:

  1. Log in to cPanel at https://cloud.lurstanhost.net:2083.
  2. If the database does not exist yet, create it under Databases with the MySQL Database Wizard. It creates the database and a user, and gives the user access. Database and user names start with your cPanel username and an underscore.
  3. Under Databases, open phpMyAdmin.
  4. Select the database in the list on the left.
  5. Open the Import tab, choose your .sql file, and select Import at the bottom of the page.

phpMyAdmin shows the largest file it accepts next to the file box. A compressed file such as backup.sql.gz or backup.sql.zip is smaller and quicker to upload. If your file is still too large, open a support ticket and we will help. We answer within one working hour, Monday to Friday, 08:30 to 17:30 (Lagos time).

Your website connects to the database with the host name localhost.

Linux VPS: the mysql command

On your own VPS, connect over SSH and run:

mysql -u USERNAME -p DATABASE_NAME < file.sql

Replace USERNAME with the database user, DATABASE_NAME with the database to import into and file.sql with the path to your file. You are then asked for the user's password.

For a compressed file, unpack it first with gunzip file.sql.gz or unzip file.sql.zip, then import the .sql file as above.

WordPress on a VPS: WP-CLI

If WP-CLI is installed, go to the WordPress folder and run:

  1. wp db export before-import.sql to keep a copy of the current database;
  2. wp db import file.sql to import your file.

Then open the website and check that the content is there.

Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)