Importing Large Database via Command Line (SSH)

0 55

Importing large database is really too much pain so I have learned recently a tweak to import the database easily in phpmyadmin and this will help you to import large database file in a short period of time.

Now Cpanel is providing Terminal Option for the Cpanel users and every Cpanel user can get the SSH access interference in their Cpanel. You may be searching how to increase phpmyadmin import file size but why increase phpmyadmin size instead let us do the thing without increasing it by using my new technique of importing database.

So I am going to help you in importing large databases phpmyadmin using the command line in your Terminal. If you are not having Terminal in your Cpanel page then you can use SSH using Terminal ( MAC user ) or Putty ( Windows User ).

Note: In case of Putty or Terminal you should have the SSH logins. If you dn’t know what is the login then ask your hosting provider to give the SSH access.

Step 1. Upload your Mysql file eg. mydatabase.sql file in your file manager you can also use WGET to remotely download your file in the file manager.

Step 2. Create the Database and User by going to Mysql database Wizard.

Step 3. Login to your SSH and follow the steps below

  • Goto the directory where you have uploaded the mydatabase.sql file
  • Type the following command and also change the highlighted details
mysql -p -u user_name database_name < mydatabase.sql

Replace ‘user_name‘, ‘database_name‘, and ‘mydatabase.sql‘ with the original details.

Use the Password of the mysql user that you have created

Result Output is like below given

[user@server ~]$ cd mydirectory
[user@server mydirectory]$ mysql -p -u user_creative user_creative < database.sql
Enter password:
[user@server mydirectory]$

Increase apache php max upload size

As normally apache php max upload size is 1024 MB by default but you can raise max upload file size in php to 2047 MB inside the WHM interference, you can get it in Tweak Setting here Main >> Server Configuration >> Tweak Settings

Increase php max upload size for WHM root user

Navigate to

/usr/local/cpanel/3rdparty/etc/php.ini

Find these two and change the value

post_max_size =
upload_max_filesize =

Change the value to 2048 or any other value as you like. It will count in MB like 2048 = 2048 MB.

This file exceeds the maximum upload size

Now if you want to change PHP upload max size then I will suggest you look over my another article which give the solution about increasing cpanel php max upload size.

Comments
Loading...