0

I'm trying to move a website to a new host. I have uploaded all the files required via ftp.

Im now trying to upload the database in PHPMYAdmin, however it gives a message that the database is too large?

I have tried unzipping it and re-zipping it, but it will still not upload? the database size is 290.5 Mg

Any assistance would be greatly appreciated

thank you

user2502658
  • 115
  • 3
  • 16
  • Perhaps [this post](http://stackoverflow.com/questions/3958615/import-file-size-limit-in-phpmyadmin) will be useful to you. – Lix Sep 22 '13 at 07:39
  • There is a hard limit (on the PHP side) for file uploads. PHPMyadmin is also limited by these restrictions. You'll have to modify some settings in your `php.ini` file and restart your server. – Lix Sep 22 '13 at 07:40
  • 1
    phpmyadmin has a feature that allows you to overcome this problem by specifying a folder to upload the database to, check the phpmyadmin config file. You can then upload the database via ftp, and choose that folder when doing an import. – Jeemusu Sep 22 '13 at 07:44
  • @Lix. thank you. Where do I find the php.ini file? – user2502658 Sep 22 '13 at 08:29
  • Follow that steps as in my comments of another post: http://stackoverflow.com/questions/3958615/import-file-size-limit-in-phpmyadmin/35084250#35084250 –  Jan 29 '16 at 12:23

2 Answers2

1

There are two settings in your php.ini that can prevent you from importing a database above a certain file size in PHPMyAdmin.

First locate your php.ini with the following script:

<?php
phpinfo();

The path is listed under "Loaded Configuration File". If you're using Ubuntu this will most likely be /etc/php5/apache2/php.ini

Then edit the file as root (used nano for you here, but any text editor is fine):

sudo nano /etc/php5/apache2/php.ini

Find the following two lines in that configuration file:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

and

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 8M

And increase both of those numbers to a number higher than the file size of your zipped database, for example:

upload_max_filesize = 1000M
post_max_size = 1000M

Save your changes, then restart your server:

sudo /etc/init.d/apache2 restart

Then refresh your PHPMyAdmin and you'll see your changes reflected there, and you'll be able to import your database.

Alternatively you could do this right in the command line instead of through PHPMyAdmin, which will bypass those PHP settings entirely:

mysql -p -u username database_name < file.sql

Just be sure to unzip it first.

Edit: I should note that changing these two configuration settings to a really high number could potentially expose you to DOS attacks if your application processes arbitrary POST data or file uploads without any validation, so it's probably a good idea to change them back to their defaults after importing your database.

Adelmar
  • 2,073
  • 2
  • 20
  • 20
  • thank you. it says my loaded configuration file is at: /usr/local/lib/php.ini. but if i try to locate that directly via cpanel, I cannot locate it? – user2502658 Sep 22 '13 at 08:46
  • Often one PHP configuration is shared by multiple customers, so web hosting providers don't allow you to edit it. You'll probably need to contact your hosting provider directly to resolve this. – Adelmar Sep 22 '13 at 08:54
0

If, as I suspect, your host provider gives you a shared phpMyAdmin installation, you don't have access to modify its configuration nor the PHP settings.

Therefore I suggest you export your database to smaller files, for example table by table. I assume you still have access to the original host for doing this. If not, you can install something like XAMPP for Windows on your workstation, changes the settings there, import your big file, then export in chunks.

Marc Delisle
  • 8,879
  • 3
  • 29
  • 29