Search code examples
mysqlsqldatabasephpmyadmincpanel

Import a large database - CPanel & MySQL & PHPMyAdmin


I have a database which has the size over 100 MB. It has the .sql.gz which means it is compressed. When I try to import it using PHPMyAdmin I get time out errors. I even tried partial imports ( Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. (This might be good way to import large files, however it can break transactions.) ) which does not work for me. Given that I'm using CPanel & PHPMyAdmin to get the job done.

How can import this database?


Solution

  • You can use BigDump for this

    1. Adjust the database configuration and charset in this file

    2. Remove the old tables on the target database if your dump doesn't contain "DROP TABLE"

    3. Create the working directory (e.g. dump) on your web server

    4. Upload bigdump.php and your dump files (.sql, .gz) via FTP to the working directory

    5. Run the bigdump.php from your browser via URL like http://www.yourdomain.com/dump/bigdump.php

    6. BigDump can start the next import session automatically if you enable the JavaScript

    7. Wait for the script to finish, do not close the browser window

    8. IMPORTANT: Remove bigdump.php and your dump files from the web server

    If Timeout errors still occure you may need to adjust the $linepersession setting in this file. Read more