Last active
February 14, 2023 20:13
-
-
Save charlesbatista/caf78a8ad2f5a304c6f134e2e4f3744d to your computer and use it in GitHub Desktop.
How to import SQL files using command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We're using MySQL database and XAMPP as our web server. In this case, I'm using Windows 11. | |
If you are struggling on importing big files to your database and you are getting any messages related to time of execution exceed or memory limit was reached, | |
try to use MySQL command line to help you get through it. | |
First of all, go to you mysql bin folder. In my case, it is: | |
- c:\xampp\mysql\bin. | |
And then you type: | |
- mysql.exe -u root -p database_name < C:\path_to_file\my_database.sql. | |
If you want to import a .gz file, type it: | |
- zcat myfile.sql.gz | mysql -u root -ppassword mydb | |
You are going to enter your password and just have to wait afterwards until it's finished. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment