> 데이터 베이스 > MySQL 튜토리얼 > 2006 – MySQL Server has gone away error during database imp_MySQL

2006 – MySQL Server has gone away error during database imp_MySQL

WBOY
풀어 주다: 2016-06-01 13:08:00
원래의
1024명이 탐색했습니다.

I was trying to import a relatively large database into MySQL via phpMyAdmin, and I was hit with the error message 2006 – MySQL server has gone away :

2006-mysql-server-has-gone-away

Why has the server gone away? lol. Thinking it was bound to be something like a size limit ( not the first time this has happened to me ), I ran some simple SQL to print out the MySQL configuration variables:

SHOW VARIABLES;
로그인 후 복사

show-variables-sql

In the resulting list, look for max_allowed_packet :

max-allowed-packet-size

If you convert 1048576 bytes into something perhaps more meaningful, such as MB, you’ll find it’s a low 1MB. Well, that’s certainly not a big enough limit for the database SQL I’d tried to import.

Edit the MySQL my.cnf file

So to increase this limit, I located the my.cnf file, which MAMP uses as part of the MySQL configuration setup:

sudo nano /etc/my.cnf
로그인 후 복사

And added a new value to the end of the file:

max_allowed_packet = 64M
로그인 후 복사

Thanks to this article for helping me understanding how to update the MySQL settings for MAMP , and this answer on stackoverflow for helping me understand why I was received the 2006 sql error.

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿