Development Tip

phpmyadmin 파일 크기가 너무 커서 데이터베이스를 가져올 수 없습니다.

yourdevel 2020. 12. 13. 11:14
반응형

phpmyadmin 파일 크기가 너무 커서 데이터베이스를 가져올 수 없습니다.


phpMyAdmin을 통해 데이터베이스를 가져 오려고했습니다. 내 데이터베이스 파일은 a.sql이고 크기는 1.2GB입니다. 로컬에서 가져 오려고 시도하고 phpMyAdmin은 다음과 같이 말합니다.

너무 큰 파일을 업로드하려고했을 수 있습니다. 이 제한을 해결하는 방법은 설명서를 참조하십시오.

이 작업이 정말 필요합니다.


업로드에 대한 파일 크기 제한이있는 PHP 때문입니다.

터미널 / 셸 액세스 권한이있는 경우 @Kyotoweb 위의 답변이 작동합니다.

이를 수행하는 한 가지 방법은 .htaccess / ini 파일 파일을 만들어 PHPmyAdmin을 통해 SQL 파일을 업로드하도록 PHP 설정을 변경하는 것입니다.

php_value upload_max_filesize 120M //file size
php_value post_max_size 120M
php_value max_execution_time 200
php_value max_input_time 200

업로드 후이 파일을 제거해야합니다.


phpmyadmin을 사용하여 대용량 데이터를 업로드하려면 다음 단계를 수행하십시오.

  1. C : \ wamp \ bin \ apache \ Apache2.4.4 \ bin에서 php.ini 파일 열기 다음 줄 업데이트
    max_execution_time = 259200
    max_input_time = 259200
    memory_limit = 1000M
    upload_max_filesize = 750M
    post_max_size = 750M
    wamp 서버를 다시 시작하거나 모든 서비스를 다시 시작한 후 phymyadmin에서 가져 오기 기능을 사용하여 데이터를 업로드하십시오. 데이터를 업로드하지 않을 때까지 두 번째 단계를 적용하십시오.
  2. c : \ wamp \ apps \ phpmyadmin4.0.4 \ libraries에서 config.default.php 파일을 엽니 다. (phpmyadmin 버전에 따라이 파일을 엽니 다.)
    Find $cfg['ExecTimeLimit'] = 300;Replace to $cfg['ExecTimeLimit'] = 0;
    이제 데이터를 업로드 할 수 있습니다.

아래와 같이 MySQL Console을 사용하여 대용량 데이터베이스를 업로드 할 수도 있습니다.

  1. WampServer 아이콘-> MySQL-> MySQL 콘솔을 클릭하십시오.
  2. root팝업에서 와 같이 데이터베이스 비밀번호를 입력하십시오.
  3. 명령어를 작성하여 데이터 삽입을위한 데이터베이스 이름 선택 USE DATABASENAME
  4. 그런 다음 소스 SQL 파일을 다음과 같이로드하십시오. SOURCE C:\FOLDER\database.sql
  5. 데이터를 삽입하려면 Enter를 누르십시오.

참고 : 압축 된 데이터베이스 파일 (예 : database.sql.zip또는) 은로드 할 수 없습니다 database.sql.gz. 먼저 압축을 풀어야합니다. 그렇지 않으면 콘솔이 충돌합니다.


내가 한 일은 다음과 같습니다.

  1. 내 XAMPP 설치된 Directoy로 이동 C:\xampp\php
  2. php.ini텍스트 편집기를 사용하여 이름이 지정된 "구성 설정"파일 을 엽니 다. Windows 컴퓨터 용 메모장도 가능합니다.
  3. 886 번 라인 근처 어딘가에 업데이트하십시오. upload_max_filesize = 128M
  4. 마찬가지로 735 번 라인에서 post_max_size = 128M
  5. 442 번 라인 max_execution_time = 300
  6. 452 번 라인 max_input_time = 60
  7. XAMPP 제어판에서 또는 Windows https://stackoverflow.com/a/6723485/969092 에서 CMD를 사용하여 Apache를 다시 시작하십시오.

끝난!


명령 줄 사용 :

mysql.exe -u USERNAME -p PASSWORD DATABASENAME < MYDATABASE.sql

여기서 MYDATABASE.sql은 SQL 파일입니다.


여기에서 아무도 언급하지 않은 또 다른 옵션은 BigDump 와 같은 도구를 사용하여 데이터베이스의 시차 적로드 를 수행하여 한계를 극복 하는 것입니다. 자체를 다시 시작하고 다음 청크로 이동하기 전에 한 번에 데이터베이스 청크를로드하는 간단한 PHP 스크립트입니다.


  1. php.ini파일 ( C:\xampp\php\) 에 아래 값을 설정하십시오.

    • max_execution_time = 0
    • max_input_time=259200
    • memory_limit = 1000M
    • upload_max_filesize = 750M
    • post_max_size = 750M
  2. config.default 파일 (C : \ xampp \ phpMyAdmin \ libraries \ config.default)을 열고 다음과 같이 값을 설정합니다.

    • $ cfg [ 'ExecTimeLimit'] = 0;
  3. 그런 다음 config.inc 파일 (C : \ xampp \ phpMyAdmin \ config.inc)을 엽니 다. 다음 줄 아래에 붙여 넣습니다.

    • $cfg['UploadDir'] = 'upload';
  4. phpMyAdmin ( C:\xampp\phpMyAdmin) 폴더로 이동하여 라는 폴더를 만들고 upload새로 생성 된 업로드 폴더에 데이터베이스를 붙여 넣습니다 (압축 할 필요 없음).

  5. 마지막으로 phpMyAdmin으로 이동하여 db를 업로드하십시오 (드롭 다운에서 데이터베이스를 선택하십시오).

upload image

  1. 그게 다야! :)

* 시간이 많이 걸리고 내 db (266mb)에서 업로드하는 데 50 분이 걸립니다. 그러므로 인내심을 가지십시오! *


우분투 14.04의 경우 다음을 사용하십시오.

  • 1- gedit 또는 nano를 사용하여 php.ini 열기 :
  • sudo gedit /etc/php5/apache2/php.ini
  • 2- 'upload_max_size'를 찾은 다음이 한 줄을 다음 줄로 바꿉니다.
  • max_execution_time = 259200 max_input_time = 259200 memory_limit = 1000M upload_max_filesize = 750M post_max_size = 750M
  • 3- php.ini 저장 및 편집기 닫기
  • 4- apache2를 다시 시작하십시오.
  • sudo 서비스 apache2 다시 시작
  • 5- 이제 열림
  • localhost : // phpmyadmin /
  • 브라우저에서 데이터베이스를 업데이트하십시오.


    편집 할 필요가 없습니다 php.ini. Just use MySQL WorkBench 로 가장 좋은 것을 제안 합니다.

    단계를 따르십시오.

    MySQL WorkBench 6.0 설치

    And In "Navigation panel"(Left side) there is option call 'Data import' under "MANAGEMENT". Click that and [follow steps below]

    1. click Import Self-Contained File and choose your SQL file
    2. Go to My Document and create folder call "dump"[simple].
    3. now you ready to upload file. Click IMPORT Button on down.

    You can also try compressing (zipping) the file. It sometimes works for me if I can't get to php.ini for phpmyadmin. If zipping reduces the file size below the maximum file size, it just might work!


    You have three options:

    • Use another way to get the file on the server, and use a mysql client on the server
    • Use another client to connect to the server and load the data
    • Change your PHP settings to allow such huge files. Don't forget to increment the execution time as well.

    to import big database into phpmyadmin there are two ways 1 increase file execution size from php.ini 2 use command line to import big database.


    If you are using MySQL in Xampp then do the steps below.

    Find the following in XAMPP control panel>Apach-Config> PHP (php.ini) file

    • post_max_size = 8M

    • upload_max_filesize = 2M

    • max_execution_time = 30
    • ut_time = 60enter code here memory_limit = 8M

    And change their sizes according to your need. I'm using these values

    post_max_size = 30M
    upload_max_filesize = 30M
    max_execution_time = 4500
    max_input_time = 4500
    memory_limit = 850M
    

    참고URL : https://stackoverflow.com/questions/9593128/cant-import-database-through-phpmyadmin-file-size-too-large

    반응형