To upload (restore/import) a MySQL database backup via the command prompt (CLI), you can use the mysql command-line utility.
Here’s how:
You must follow these requirement
-
You must have a MySQL backup file (e.g.,
backup.sql) -
MySQL server should be installed and running
-
You should have credentials for the MySQL user
If you are working with XAMPP, You need to go to location of xampp\mysql\bin

Command
mysql -u [username] -p [database_name] < [path_to_backup_file].sql
Example:
mysql -u root -p my_database < D:\backups\my_backup_name.sql
-u root: MySQL username-p: Prompts for passwordmy_database: The target database (must exist already)< my_backup.sql: Redirects the.sqlfile contents to the MySQL server
Notes:
Database must exist before importing. To create one, use:
mysql -u root -p -e “CREATE DATABASE my_database;”
