Back

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

I am having a large (~150mb) SQL file that I try to import. The file is too large to do it through the PHPMyAdmin even splitting it into many pieces and it is also too large to import through a PHP script as it times out after some 30 seconds of processing the script. So I ty to directly import the file from the MySQL command line.

While looking on the internet, it has shown me that I must be using either use database_name < file_name.sql or source file_name.sql but I could not able to get either of those to be working.

Using < gives the generic MySQL syntax error while using the source gives a lightly more promising failed to open file 'file_name.sql', error: 2 so I thought that the source command is on the right track.

I am using the xampp as the localhost server on the windows machine. I have tried to place the file in the xamppmysqlbin and xamppmysqldatadatabase_name.

Any suggestions on how to import this .sql file into the  MySQL either from the MySQL command line or by any other means would be greatly appreciated.

1 Answer

0 votes
by (12.7k points)

With the xampp I think you need to use the full path at the command line, something like this, perhaps:

C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql

If you want to learn more about SQL, Check out this SQL Certification by Intellipaat.

For more information visit :

Related questions

0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
asked Jan 7, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jul 11, 2019 in SQL by Tech4ever (20.3k points)

Browse Categories

...