Categories PHP-MySQL

Khắc phục lỗi Error: MySQL shutdown unexpected làm bạn không khởi động được MySQL trên XAMPP

Đây là thông báo lỗi đầy đủ của nó:

Error: MySQL shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Press the Logs button to view error logs and check the Windows Event Viewer for more clues. If you need more help, copy and post this entire log window on the forums.

Một trong các cách phổ biến tìm thấy trên mạng là xóa file ibdata1, nhưng điều này rất may rủi, có thể thành công mà cũng có thể mất hết dữ liệu.

Cách hay hơn bạn làm như sau:

  • Vào thư mục XAMPP (thường nằm ở ổ cài đặt C)
  • Backup thư mục mysql trong đó để dự phòng
  • Đổi tên thư mục mysql/data thành mysql/data_old (bạn có thể chọn tên bất kỳ)
  • Tạo thư mục mới mysql/data
  • Copy toàn bộ nội dung nằm trong thư mục mysql/backup sang thư mục sang thư mục mysql/data vừa mới tạo
  • Copy các thư mục database của bạn ở mysql/data_old sang mysql/data (bỏ qua các thư mục mysqlperformance_schema, và phpmyadmin nằm trong from data_old)
  • Cuối cùng copy file ibdata1 từ mysql/data_old và sang thư mục mysql/data để thay thế file có tên tương tự
  • Khởi động MySQL từ XAMPP. Vậy là xong rồi!

Comments are closed.

Back to Top