Arun Kumar
Arun Kumar

Reputation: 121

how to upload a large sql file in phpmyadmin on server

How can i upload a large sql file in phpmyadmin on server. I'm trying to migrate my wordpress website from localhost to online but when i'm trying to upload my sql file which is large then 50 MB it show error. I have only cpanel access.

Upvotes: 1

Views: 11781

Answers (6)

Gorakh Yadav
Gorakh Yadav

Reputation: 302

Try to import it from mysql console as per the taste of your OS.

mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql path}

or if it's on a remote server use the -h flag to specify the host.

mysql -u {DB-USER-NAME} -h {MySQL-SERVER-HOST-NAME} -p {DB-NAME} < {db.file.sql path}

for more example

Upvotes: 0

Isaac Bennetch
Isaac Bennetch

Reputation: 12462

Given the limitations your host places on your account, I think your best solution is to use the phpMyAdmin "UploadDir" feature.

You'll need to be able to control the configuration of your phpMyAdmin, which probably means you'll need to install your own copy to your web space, but that's relatively easy. Then you'll have to modify your config.inc.php to add a line like $cfg['UploadDir'] = 'upload'; (you can use any directory name here). Next, create the directory and upload your SQL file there using SFTP, SSH, or whatever other means your host gives you of interacting with your files. Now the file should appear in a dropdown on the Import tab.

Upvotes: 1

bibincatchme
bibincatchme

Reputation: 353

You can upload large .sql file in two way.

1.Edit the php.ini page

post_max_size = 800M 
upload_max_filesize = 800M 
max_execution_time = 5000 
max_input_time = 5000 
memory_limit = 1000M 

most of the case the execution time will be time out and fail the upload.

  1. so that use the command line if you have back end access.

    mysql -p -u your_username your_database_name < file.sql

    mysql -p -u example example_live < /home2/example/public_html/file.sql

/home2/example/public_html/file.sql (file path)

Upvotes: 1

ScorpionGod
ScorpionGod

Reputation: 48

You can compress your sql file, then upload the sql zip file to the server. If the file size is still higher than limit stated in your server, you may need to increase the limits as explained by @DongHyun.

However, most shared hosting plans don't allow PHP.ini editing. In that case, contacting customer support might be helpful.

Upvotes: 0

Sam Tolton
Sam Tolton

Reputation: 357

You need to break your SQL file into smaller SQL files.

To do this when you export from localhost, only choose a few tables to export at a time (you may have to choose the Custom export method).

Basically you need to make every SQL file smaller than 50MB. You can then import each SQL file, one by one.

Upvotes: 0

DongHyun  Song
DongHyun Song

Reputation: 121

modify two limit options in 'php.ini'

// larger than 50M
upload_max_filesize = 00M
post_max_size = 00M

Upvotes: 1

Related Questions