In this video I have shown how to import a MySql Database which is saved as .sql file.
Download a Sample database here.
- 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;
Now Open command prompt in Administrator mode.
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"
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.
Now if it execute the command without any errors as shown. The import is successful. All the tables from the .sql is imported successfully.