MySQL: Import Database from Command Line

Copy your sql file and paste it inside xampp/mysql/bin directory. Let’s say our sql filename is: “userinfo.sql”.

Now, open command line and run following commands.

# Logging into mysql
mysql -u root

# Select Database where you want to import sql file
use DBNAME

# Run import!
source "c:\xampp\mysql\bin\unserinfo.sql"

Leave a comment