Forums

The great place to discuss topics with other users

How to Import a SQL File into MySQL via SSH (No phpMyAdmin required)

'
Join the Conversation Publier la réponse
Jane Marcia
Admin
Joined: 2025-05-17 02:14:16
2025-06-01 20:49:41

Step 1: Upload the SQL file via SFTP or SCP

Put youdatabase.sql in your home dir or /tmp/:

scp youdatabase.sql root@your-server-ip:/tmp/

Or use FileZilla to upload it into /root or /tmp.

Step 2. Run the Import

mysql -u yourdatabaseUsername -p yourdatabaseName < /tmp/youdatabase.sql

It will ask for the password:

yourdatabasePassword

🚨 Make sure that user has full privileges on yourdatabaseName. If not, use root:

mysql -u root -p < /tmp/yourdatabaseName.sql

That is all :)