How to Import SQL file into mysql

0 votes

I have a database called edureka. I haven't created any tables there. But I have a SQL file which contains all the necessary data for the database. The file is edureka.sql which is in C:\ drive. This file has 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:/edureka.sql;

But this didn't work.

Aug 19, 2020 in PHP by kartik
• 37,520 points
874 views
I did this, but for some reason not all of my tables were imported..what do I do?

Hello,

If you are using phpMyAdmin, you can simply create a database and then go to the import tab and upload there, or you can SSH to your server and run 'mysql -u username -ppassword database_name < FILE.sql'. Make sure -ppassword has your password after it with no spaces.

1 answer to this question.

0 votes

Hello @kartik,

From the mysql console:

mysql> use DATABASE_NAME;

mysql> source path/to/edureka.sql;

make sure there is no slash before path if you are referring to a relative path.

Hope it helps!!
Thank You!

answered Aug 19, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
1 answer

How to save MySQL query output to excel or .txt file?

Hello @kartik, You can write following codes to ...READ MORE

answered Aug 20, 2020 in PHP by Niroj
• 82,840 points
3,952 views
0 votes
0 answers

How to write into a file in PHP?

I have this script on one free ...READ MORE

Jun 20, 2022 in PHP by Kithuzzz
• 38,000 points
450 views
0 votes
0 answers

How to upload images into MySQL database using PHP code

I'm attempting to save photos from an ...READ MORE

Aug 3, 2022 in PHP by Kithuzzz
• 38,000 points
1,530 views
0 votes
1 answer

What is Php Mysql Database? How php connect to database?

Hello kartik, MySQL is the most popular database ...READ MORE

answered Feb 25, 2020 in PHP by Dey
1,133 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,995 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,694 views
0 votes
1 answer

How do I import an SQL file using the command line in MySQL?

Hello @kartik, Try: mysql -u username -p database_name < ...READ MORE

answered Aug 26, 2020 in PHP by Niroj
• 82,840 points
1,337 views
0 votes
1 answer

How to concatenate text from multiple rows into a single text string in SQL server?

Hello @kartik, Use COALESCE: DECLARE @Names VARCHAR(8000) SELECT @Names = ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,840 points
3,077 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP