Increase the Upload Size for MySQL Database in cPanel with phpMyAdmin

cPanel/WHM Server imposes a limit on the size of importing a WordPress MySQL database that can be imported into phpMyAdmin. The default size is 50MB which is set in the cPanel/WHM settings. You can change the settings either in cPanel or separately in WHM depending on what you have available.

Failing that there are other ways to increase the file size:

  • php.ini
  • .htaccess
  • wp-config.php
  • MySQL import
  • wp-cli import

cPanel

Cpanel Mysql Database Size

Go to PHP Selector, then Options, change values for both these parameters to the size you need it to be (example uses 128M):

post_max_size 128M
upload_max_size 128M

WHM

– Log into your WHM interface and type Tweak in the search bar.

Tweak Settings Cpanel Databse

The Tweak settings appear, in the find field on the right type: upload size

Tweak Max Upload Size Cpanel

Change the cPanel PHP max upload size to what you need and save.

Go back to Tweak Settings and in the find bar type: post

Tweak Post Size Cpanel

Change the cPanel PHP max POST size to what you need

php.ini

If you don’t have access to either cPanel or WHM or use a non-cPanel server you can try setting a php.ini file. This file sits in your web root directory, open it and edit the 2 values – lets say you need it to be 128mb:

upload_max_filesize = 128M 
post_max_size = 128M

.htaccess

You can also declare the values in your .htaccess file which also sits in your webroot directory.

php_value upload_max_filesize 128M 
php_value post_max_size 128M

wp-config.php

You can also try setting these values as php constants in your wp-config.php file which also sits in your web root directory, but also can be sometimes found in the parent directory of the webroot, set the values like so:

@ini_set( 'upload_max_size' , '128M' ); 
@ini_set( 'post_max_size', '128M');

Hopefully one of the above can increase the size that you need to upload to.

If not there is also the option of importing a MySQL database directly in MySQL or using WordPress’ wp-cli.

2 Comments

  1. Tycoon on April 18, 2022 at 5:19 pm

    Can you tell me how to reduce the size of my database.. It has grown over 1. 5GB… Some say it slows down website…

    • Neil Gowran on April 21, 2022 at 7:41 am

      Try running WP Sweep plugin (take a back up first)

Leave all Comment