Copy large files into MySQL DB

Stephen Akugbe - Dec 3 '23 - - Dev Community

I recently wanted to copy a large file into my MySQL database (I'm using phpmyadmin) and I was having an error because the file was too large.
Here are the steps I followed to copy it successfully:

Step 1: Configure XAMPP for Large File Imports

  • Open the XAMPP Control Panel.
  • Click on the "Config" button for the Apache server.
  • Select "php.ini" to edit the PHP configuration file.
  • Find and update the following settings:

upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 600

Adjust the values according to the size of your large file.

  • Save the changes and restart the Apache server.

Step 2: Prepare Your MySQL Database

  • Open phpMyAdmin from the XAMPP Control Panel.
  • Create a new database or select an existing one where you want to import the data.
  • Create a table with the appropriate columns to match the data in your file.

Step 3: Choose the Right File Format

  • Ensure your large file is in a format suitable for importing into MySQL. CSV (Comma-Separated Values) is a common choice.

Step 4: Use MySQL Command-Line Tools

  • Open a command prompt or terminal and navigate to the XAMPP MySQL bin directory. Use the following command to import the file:

mysql -u your_username -p your_database_name < path/to/your/large_file.sql

Replace 'your_username', 'your_database_name', and the file path accordingly. Enter your MySQL password when prompted.

Congratulations! You've successfully imported a large file into your MySQL database using XAMPP. These steps should help you efficiently manage large datasets.
Thank you for reading this post

. . . . . . . . . . . . . . . . . . . . .
Terabox Video Player