Friday, October 31, 2014

Importing big size of data mysql

Option 1 - Compress SQL file Then Upload

Compress you .sql file using zip, gzip or bzip2 method. SQL files basically are plain text files so they compress quite well. If you are still exceeding the limit use one of the other options.


Option 2 - Increase PHP file size limit

Open your php.ini file. If you not sure where your php.ini is located, check here.
/etc/php.ini

Find following lines
post_max_size
upload_max_filesize
and increase values to required size in MB. E.g.
post_max_size = 10M
upload_max_filesize = 10M

Save the file and restart apache:

/etc/init.d/apache2 restart

After import is completed you may want to restore original values.
Option 3 - use mysql command in terminal

You can bypass phpMyAdmin altogether and do the import via terminal.

Upload your sql file to the web server and run flowing command in terminal:

mysql -u -p < /path/file.sql
 
where:
- your MySQL username. e.g. root
- database you are importing to
/path/file.sql - full path to your .sql file

It will prompt you for your MySQL password and complete the import.


php.ini can be located in quite few different places depending on your Linux distribution and Apache installation.

Some common places are:
/etc/php.ini
/etc/php/php.ini
/etc/php5/php.ini
/etc/php5/apache2/php.ini
/usr/bin/php5/bin/php.ini


If you still can't find it, run:


find / -name php.ini

 
This will find all files with name php.ini on your server.