Parfum Shop's Blog

You come when you need, away when you get

Shell Command Import Big MySQL File.

By • Apr 17th, 2009 • Category: Linux

To import mysql, we can use phpMyAdmin with import tool. It’s easiest way. Imported File can be compressed file file like .gz and .zip

But import mysql with phpMyadmin very slow and this way will not always succesfull. If we have a big mysql file, we will get problem. We must have an access to this file:

phpMyAdmin (config.default.php)
$cfg['ExecTimeLimit'] = 300;

php (php.ini)
Resource Limits, Data Handling, File Uploads, ect

We can make mysql partially and import it one by one, but it’s also make our job slower.

The efective way to solve this problem is upload mysql file to our server. Better we compress it, so we get smallest size, then extract it.

To extract file .zip with shell linux
unzip -0 file.zip
To extract file .gz with shell linux
tar -xzfv file.tar.gz -C

Login to MySQl

mysql -h localhost -u root -p
Fill The Password. If password correct, we will get prompt mysql>

Then select Database

use nama_database

Open extracted file with sintaks:

\. namafile.sql
For example:
\. /home/okecoy/dump.sql

Wait until import prosses finish:
To exit from mysql type:

quit

is
Email this author | All posts by

Leave a Reply