Import a MySQL database via command line

October 20, 2015 — Leave a comment

Why use the command line when you can just use PHPMyAdmin or some other GUI tool? Because it’s faster, less chance for errors and you may need to anyway if your database size is larger than the upload limits in place by your server or GUI software.

Plus, it’s easy to do!

Let’s lay out what we’ll be importing:

Database name: linuxospro_test
Database user: linuxospro_user
Database password: password
Database dump name: linuxospro_test.sql
Database dump location: /home/backups/

Importing via cli:
Type this to import using the information about our setup above…

It will then prompt you for a password.

If you like, you can also do it as root so you don’t have to hunt down linuxospro_user’s password:

(then the root password)

Good luck, and comment if you have any questions/issues!

No Comments

Be the first to start the conversation.

Leave a Reply