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을 사용하여 대용량 데이터를 업로드하려면 다음 단계를 수행하십시오.
- C : \ wamp \ bin \ apache \ Apache2.4.4 \ bin에서 php.ini 파일 열기 다음 줄 업데이트
wamp 서버를 다시 시작하거나 모든 서비스를 다시 시작한 후 phymyadmin에서 가져 오기 기능을 사용하여 데이터를 업로드하십시오. 데이터를 업로드하지 않을 때까지 두 번째 단계를 적용하십시오.max_execution_time = 259200 max_input_time = 259200 memory_limit = 1000M upload_max_filesize = 750M post_max_size = 750M
- c : \ wamp \ apps \ phpmyadmin4.0.4 \ libraries에서 config.default.php 파일을 엽니 다. (phpmyadmin 버전에 따라이 파일을 엽니 다.)
Find$cfg['ExecTimeLimit'] = 300;
Replace to$cfg['ExecTimeLimit'] = 0;
이제 데이터를 업로드 할 수 있습니다.
아래와 같이 MySQL Console을 사용하여 대용량 데이터베이스를 업로드 할 수도 있습니다.
- WampServer 아이콘-> MySQL-> MySQL 콘솔을 클릭하십시오.
root
팝업에서 와 같이 데이터베이스 비밀번호를 입력하십시오.- 명령어를 작성하여 데이터 삽입을위한 데이터베이스 이름 선택
USE DATABASENAME
- 그런 다음 소스 SQL 파일을 다음과 같이로드하십시오.
SOURCE C:\FOLDER\database.sql
- 데이터를 삽입하려면 Enter를 누르십시오.
참고 : 압축 된 데이터베이스 파일 (예 : database.sql.zip
또는) 은로드 할 수 없습니다 database.sql.gz
. 먼저 압축을 풀어야합니다. 그렇지 않으면 콘솔이 충돌합니다.
내가 한 일은 다음과 같습니다.
- 내 XAMPP 설치된 Directoy로 이동
C:\xampp\php
php.ini
텍스트 편집기를 사용하여 이름이 지정된 "구성 설정"파일 을 엽니 다. Windows 컴퓨터 용 메모장도 가능합니다.- 886 번 라인 근처 어딘가에 업데이트하십시오.
upload_max_filesize = 128M
- 마찬가지로 735 번 라인에서
post_max_size = 128M
- 442 번 라인
max_execution_time = 300
- 452 번 라인
max_input_time = 60
- XAMPP 제어판에서 또는 Windows https://stackoverflow.com/a/6723485/969092 에서 CMD를 사용하여 Apache를 다시 시작하십시오.
끝난!
명령 줄 사용 :
mysql.exe -u USERNAME -p PASSWORD DATABASENAME < MYDATABASE.sql
여기서 MYDATABASE.sql은 SQL 파일입니다.
여기에서 아무도 언급하지 않은 또 다른 옵션은 BigDump 와 같은 도구를 사용하여 데이터베이스의 시차 적로드 를 수행하여 한계를 극복 하는 것입니다. 자체를 다시 시작하고 다음 청크로 이동하기 전에 한 번에 데이터베이스 청크를로드하는 간단한 PHP 스크립트입니다.
php.ini
파일 (C:\xampp\php\
) 에 아래 값을 설정하십시오.max_execution_time = 0
max_input_time=259200
memory_limit = 1000M
upload_max_filesize = 750M
post_max_size = 750M
config.default 파일 (C : \ xampp \ phpMyAdmin \ libraries \ config.default)을 열고 다음과 같이 값을 설정합니다.
- $ cfg [ 'ExecTimeLimit'] = 0;
그런 다음 config.inc 파일 (C : \ xampp \ phpMyAdmin \ config.inc)을 엽니 다. 다음 줄 아래에 붙여 넣습니다.
$cfg['UploadDir'] = 'upload';
phpMyAdmin (
C:\xampp\phpMyAdmin
) 폴더로 이동하여 라는 폴더를 만들고upload
새로 생성 된 업로드 폴더에 데이터베이스를 붙여 넣습니다 (압축 할 필요 없음).마지막으로 phpMyAdmin으로 이동하여 db를 업로드하십시오 (드롭 다운에서 데이터베이스를 선택하십시오).
- 그게 다야! :)
* 시간이 많이 걸리고 내 db (266mb)에서 업로드하는 데 50 분이 걸립니다. 그러므로 인내심을 가지십시오! *
우분투 14.04의 경우 다음을 사용하십시오.
편집 할 필요가 없습니다 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]
- click Import Self-Contained File and choose your SQL file
- Go to My Document and create folder call
"dump"[simple]
. - 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 = 60
enter 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
'Development Tip' 카테고리의 다른 글
webWorker에서 localStorage에 액세스 (0) | 2020.12.13 |
---|---|
Django : 쿼리를 통해 열 값의 합계 계산 (0) | 2020.12.13 |
angularjs의 범위에 바인딩되지 않는 확인란 (0) | 2020.12.13 |
PDF를 만드는 동안 마크 다운 페이지 나누기 (0) | 2020.12.13 |
팬더 시리즈를 필터링하는 방법 (0) | 2020.12.13 |