Skip to main content

[Thủ Thuật Linux] Fix lỗi "Error: MySQL shutdown unexpected" trên XAMPP

Lỗi "Error: MySQL shutdown unexpected"  xuất hiện khi khởi động XAMPP 

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

Hướng dẫn fix lỗi Error: MySQL shutdown unexpected mà ko mất dữ liệu

Bước 1: Vào thư mục XAMPP

Bước 2: Backup thư mục mysql trong đó để dự phòng

Đổi tên thư mục mysql/data thành mysql/data_old (data_old  : bạn có thể chọn tên bất kỳ);

Bước 3: Tạo thư mục mới mysql/data

Bước 4: 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;

Bước 5: Copy các thư mục chứa 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);

Bước 6: 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ự;

Bước 7: Khởi đông MySQL từ XAMPP.