Shiv Singh
Shiv Singh

Reputation: 7221

How to import 5 GB MySQL Dump file in phpmyadmin

I want to import a sql file of approx 5 GB. But its causing problem while loading. Is there any way to upload it without splitting the sql file ?

i have tried to import by terminal also but that also so many errors.

please help me on this.

Upvotes: 2

Views: 4617

Answers (3)

RaMeSh
RaMeSh

Reputation: 3424

Method 1:- If you aren't familiar with the command line and you really want to stick with a GUI style import then you can use BigDump (http://www.ozerov.de/bigdump/).

  • I used it once but it's been a while. From what I remember you will download a file named bigdump.php (with some instructions) and put it on your webserver in the directory with the MySQL DB dump file that is too large to import via PHPMYADMIN.
  • Then navigate to it using your browser - something like http://your-website.com/bigdump.php.

If you are familiar with the command line and using a Linux based system then you can use code like like this:

mysql -u USERNAME -p DATABASENAME < FILENAME.sql
  • The database and user (with privileges to the database) will need to exist prior to running this command though.
  • Note I copied the above command from another source. I always do my dumps and restores like this: DUMP: mysqldump -u DB_USER -h DB_HOST -pDB_PASSWORD DB_NAME | gzip -9 > DB_NAME.sql.gz RESTORE: gunzip < PATH_TO_DUMP/DB_NAME.sql.gz | mysql -u DB_USER -pDB_PASSWORD DB_NAME

Finally, and most painfully, you could choose to dump individual tables or groups of tables into small enough dumps. Then restore these individual dumps one at a time via PHPMYADMIN.

You can approach second method also:

Method 2:- You can:

  • increase memory_limit
  • increase post_max_size
  • increase max_execution_time
  • must restart Apache after doing all this.
  • or use Big Dump

Upvotes: 2

Techie
Techie

Reputation: 45124

Most probably you won't be able to import a 5GB database on PHPMyAdmin. Try BigDump. You can download it here. Step are mentioned below.

Download and unzip bigdump.zip on your PC.

Open bigdump.php in a text editor, adjust the database configuration and dump file encoding.

Drop the old tables on the target database if your dump doesn’t contain “DROP TABLE” (use phpMyAdmin).

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

Upload bigdump.php and the dump files (*.sql or *.gz) via FTP to the working directory (take care of TEXT mode upload for bigdump.php and dump.sql but BINARY mode for dump.gz if uploading from MS Windows).

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

Now you can select the file to be imported from the listing of your working directory. Click “Start import” to start.

BigDump will start every next import session automatically if JavaScript is enabled in your browser.

Relax and wait for the script to finish. Do NOT close the browser window!
IMPORTANT: Remove bigdump.php and your dump files from your web server.

Else try the command line

mysql -u user_name -p database_name < path/to/the/file.sql

Upvotes: 2

Shiv Singh
Shiv Singh

Reputation: 7221

if your apache is not enabled to max file size 5GB than you can not import such big file.

Use php big dump tool its best ever i have seen. its free and opensource

http://www.ozerov.de/bigdump/

Upvotes: 1

Related Questions