How to Import a Database Using the Command Line
If you're not familiar with using SSH, it's easier to import a database using Adminer. However, if your database is very large (for example, more than 1GB), it can be easier to import a database using MySQL from the command line.
If you haven't already copied the file containing your database export to your server, you should first use SFTP to copy the file to your server. You should SFTP the file to the server using the same system user that owns the app, which is the serverpilot user by default.
Next, SSH into your server as the same user you used to SFTP the file to your server.
The correct command to run to import the database depends on the file extension of the exported database dump.
If the file ends in .sql.gz, use the following command to import the file, where DB_NAME is your database name and DB_USER is your database username:
zcat DB_NAME.sql.gz | mysql --password --user DB_USER DB_NAME
If the file ends in just .sql (there's no .gz), use the following command to import the file:
cat DB_NAME.sql | mysql --password --user DB_USER DB_NAME
Once you run either of the above commands, you'll be prompted for the database user's password. Note that the MySQL username and password are not the same as the system user password you used to SSH into your server.