You Installed XAMPP and you want to import existing data from other installation or from host. First you need to export the data. In this case I’m using WordPress installation and I want to have copy of my whole site on localhost installation.
Here if we face such a situation, import large .sql file in XAMPP. Here is a Smart Solution to import large .sql file with the command prompt in XAMPP for Windows.
“Here We Learn How To Command-Line Tools (Shell) to import large database SQL file.”
Import mysql db using command line is very simple statements, effective and fast compare to importing huge database from phpmyadmin. There are one more advantage using this method the default mysql db upload file size is doesn’t a matter using Command-Line Tools (Shell).
#1. Open the XAMPP Control Panel
Make sure Apache and MySQL are running and click the Shell button in the XAMPP Control Panel. If as it is not the Run it By Seeing the picture below :
#2. To import database, use the following command
[php]mysql -u username -p database_name > "/path/file.sql"[/php]
- username – your MySQL username. e.g. root
- database_name – database name you are importing to
- /path/file.sql – full path to your .sql file
when you haven’t created a MySQL username. In that case, you need to type “root” for the username as the default user and its password = “” as blank.
Note: On the below screen command, you will define own database name. The database name will be the one that you created in the phpMyAdmin and would like to import to SQL file. In our case, we have database “the_code_developer”.
Enter password: (leave it blank, it’s not set by default)
#3. If you want to see import process to screen then use the following command
[php]mysql -u username -p -v database_name > "/path/file.sql"[/php]
Once your database SQL file successfully import then you will get following response like in the below image.
“Here We Learn How To Import Large SQL Database Files Into MySQL To Change configuration file”
One of the Known reasons, during this case is that the task grave a information, as a result of as everyone is aware of there is a limitation with the file size of a information with phpmyadmin (Max: 2,048 KB with the default configuration of xampp). This successively, is not a giant limitation as you’ll be able to increase the allowed file size of the information but it’ll take time to tack together it and it will not be therefore quick like the statement (at less for folks with a information of over 100 MB).
When you have large SQL file and you want to import it into your database using phpMyAdmin, while uploading, an error is shown in phpMyAdmin. The error that appears is displayed below.
You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
In such case, follow the below given steps:
Open php.ini file from C:\xampp\php and update the following lines.
max_execution_time = 259200
max_input_time = 259200
memory_limit = 1000M
upload_max_filesize = 750M
post_max_size = 750M
You can change the respective data sizes according to your convenience.You can change the data sizes according to your SQL File.
Open php.ini file and find the changed variable values. After confirming the checked data,start XAMPP Server and Upload the data using Import Function in phpMyAdmin. If data will not uploaded successfully then go to second step . I am sure second step definitely large data upload into your data server .