Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in SQL by (20.3k points)

I have a database called nitm. I haven't created any tables there. But I have a SQL file that contains all the necessary data for the database. The file is nitm.sql which is in C:\ drive. This file has a size of about 103 MB. I am using wamp server.

I have used the following syntax in MySQL console to import the file:

mysql>c:/nitm.sql;

But this didn't work.

1 Answer

0 votes
by (119k points)

Run these commands in the MySQL console to import the SQL file :

mysql> use DatabaseName;

mysql> source_path/to/file.sql;

Note: Don't use a slash in the starting of the file path referring to the relative path. 

I recommend checking out this SQL Tutorial to learn the fundamentals of SQL.

Related questions

0 votes
1 answer
asked Jan 7, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
asked Sep 6, 2019 in SQL by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...