Press enter to see results or esc to cancel.

Import Mysql Database .sql File to Mysql

In this video I have shown how to import a MySql Database which is saved as .sql file.

Download a Sample database here.

  1. First create a new database with any name in which you want to import.Open the MySQL command line and execute the create database command.
    create database aml_copy;
  2. Now Open command prompt in Administrator mode.

  3. Navigate to the location where you have installed MySQL. In my pc its installed in “C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin”
    Navigate to the location by entering the below command.

    cd "C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin"
  4. The command for importing sql file is,

    mysql -u YourUser -p YourDatabaseName < wantedsqlfile.sql

    Now in our case to import the command will be.

    mysql -u root -p aml_copy < "C:\Users\MIRITPC\Desktop\jas\aml.sql"

    Take care while giving the location of the file, as I give here "C:\Users\MIRITPC\Desktop\jas\aml.sql" is my location where I saved the aml.sql file.

  5. Now if it execute the command without any errors as shown. The import is successful. All the tables from the .sql is imported successfully.




Leave a Comment