ข้อผิดพลาด "เซิร์ฟเวอร์ MySQL หายไปแล้ว": วิธีแก้ไขข้อความแสดงข้อผิดพลาด
MySQL Error 2006 "เซิร์ฟเวอร์ MySQL หายไปแล้ว" เกิดขึ้นซ้ำแล้วซ้ำอีก - โดยเฉพาะเมื่อนำเข้าฐานข้อมูลไปยัง MySQL มีวิธีแก้ไขข้อผิดพลาดอย่างง่าย ๆ คุณสามารถดูภาพรวมของทุกขั้นตอนได้ที่นี่
เพียงแก้ไขข้อผิดพลาด MySQL 2006 "เซิร์ฟเวอร์ MySQL หายไป"
ข้อผิดพลาด MySQL นี้เกิดขึ้นเมื่อนำเข้าฐานข้อมูลที่มีขนาดใหญ่เกินไปหรือการเชื่อมต่อช้าเกินไปสำหรับการอัพโหลด เพื่อแก้ไขข้อผิดพลาดเพียงแค่เปลี่ยนสองตัวแปรในไฟล์กำหนดค่า MySQL
- ภายใต้ XAMPP ใน Windows คุณจะพบไฟล์กำหนดค่าใน C: \ xampp \ mysql \ bin \ my.cnf โดยค่าเริ่มต้น
- หากไฟล์นี้ไม่มีอยู่คุณสามารถใช้
คลิกขวา> "ใหม่"> สร้าง "เอกสารข้อความ" - เคล็ดลับที่เป็นประโยชน์อื่นจะบอกวิธีบันทึกไฟล์ด้วยนามสกุลไฟล์ใหม่ (.cnf)
- บน Linux ไฟล์นี้อยู่ที่ /etc/mysql/my.cnf โดยค่าเริ่มต้น
ในไฟล์นี้คุณจะต้องป้อนค่าที่สูงขึ้นสำหรับตัวแปรต่อไปนี้:
- wait_timeout = 60 ที่ นี่คุณป้อนการหมดเวลาที่ต้องการในไม่กี่วินาที - หากยังคงต่ำเกินไปคุณสามารถเพิ่มได้อีก
- max_allowed_packet = 100M ตัวแปรนี้พิจารณาขนาดแพ็กเกจสูงสุดของการอัปโหลด
ตอนนี้ตั้งค่าของตัวแปรนี้ขึ้นเพื่อให้มีขนาดใหญ่กว่าขนาดไฟล์ของฐานข้อมูลที่จะนำเข้า - ในที่สุดรีสตาร์ท MySQL - ข้อผิดพลาดไม่ควรเกิดขึ้นอีกต่อไป
- สำคัญ: สำหรับระบบที่ใช้งานจริงคุณควรรีเซ็ตตัวแปรที่เปลี่ยนแปลงเป็นค่าเริ่มต้นหลังจากนั้นเนื่องจากอาจเป็นช่องโหว่ด้านความปลอดภัยสำหรับผู้โจมตี
ในบทความถัดไปเราจะแสดงให้คุณเห็นว่าการนำเข้าฐานข้อมูลไปยัง MySQL โดยใช้เครื่องมือ phpMyAdmin อย่างไร