SQL | 380 Views

How to Import a Large Database into XAMPP via Command Line (CMD)

's Gravatar
Feb 10, 2023
step 1: Open XAMPP server and click on shell
step 2: mysql -u root -p
Step 3: Enter password of your database, normally it will be empty
Step 4: use <database_name> [select database] 
step 5: source <SQL_file_destination> [enter your SQL file path]
Details
  1. Open XAMPP control panel and click on the “Shell” button.
  2. In the shell, type mysql -u root -p and hit Enter. This will prompt you to enter the password for the root user (if you haven’t set a password, you can just hit Enter).
  3. Once you’re logged into MySQL, type use <database_name> to select the database you want to import the SQL file into.
  4. Finally, type source <SQL_file_destination> and provide the path to the SQL file you want to import (e.g. C:\path\to\file.sql). Hit Enter to execute the command, and wait for the import process to complete.

Once the import is finished, you should see a confirmation message in the shell, and the data from the SQL file should be available in your database.

Database