Skip to content

How to import large databases in MySQL?

Last updated on December 16, 2014

While moving your web application to new host , you may get errors while importing large database into new hosting sever via PHPMyAdmin tool due to upload limitations in PHP. Normally we can only import 2MB file via PHPMyAdmin. However we can change this behavior with minimal configuration changes to your PHP installation.

How do i change configuring settings of PHP installation
: Find “php.ini” file in a folder of your http server. For example in my case , i am using XAMPP so it’s at : “C:\xampp\php\php.ini”.

Now open php.ini file, then edit upload_max_filesize and post_max_size property values to 10M.

    upload_max_filesize = 10M
    post_max_size = 10M

Note: The PHP documentation states that the memory_limit setting also affects file uploading and memory_limit should be larger than post_max_size.

Using command Line

Command line will always be the most efficient and easy however not so friendly. If you have access to terminal open it and use the blow command.

For example if you want to access MySQL in xampp ,go to xampp\mysql\bin via command line

mysql -u username -p -h HostName DatabaseName < c:\test\dump.sql

if the database name is present in the dump

mysql -u username -p -h HostName < c:\test\dump.sql

That's it.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments