How to import large sql file in phpmyadmin

前端 未结 20 1309
一向
一向 2020-11-29 17:04

I want to import a sql file of approx 12 mb. But its causing problem while loading. Is there any way to upload it without splitting the sql file ?

相关标签:
20条回答
  • 2020-11-29 18:07

    I stumbled on an article and this worked best for me

    1. Open up the config.inc.php file within the phpmyadmin dir with your favorite code editor. In your local MAMP environment, it should be located here:

    Hard Drive » Applications » MAMP » bin » config.inc.php

    1. Do a search for the phrase $cfg[‘UploadDir’] – it’s going to look like this:

    $cfg['UploadDir'] = '';

    1. Change it to look like this:

    $cfg['UploadDir'] = 'upload';

    1. Then, within that phpmyadmin dir, create a new folder & name it upload.

    2. Take that large .sql file that you’re trying to import, and put it in that new upload folder.

    3. Now, the next time you go to import a database into phpMyAdmin, you’ll see a new dropdown field right below the standard browse area in your “File to Import” section.

    0 讨论(0)
  • 2020-11-29 18:07

    One solution is to use the command line;

    mysql -h yourhostname -u username -p databasename < yoursqlfile.sql

    Just ensure the path to the SQL file to import is stated explicitly.

    In my case, I used this;

    mysql -h localhost -u root -p databasename < /home/ejalee/dumps/mysqlfile.sql

    Voila! you are good to go.

    0 讨论(0)
提交回复
热议问题