XAMPP error not able to start * no error shown in

MySQL failed to start. The error.log file show log as below;



2024-08-18 20:45:04 0 [Note] Starting MariaDB 10.4.32-MariaDB source revision c4143f909528e3fab0677a28631d10389354c491 as process 22548

2024-08-18 20:45:04 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!!

2024-08-18 20:45:04 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions

2024-08-18 20:45:04 0 [Note] InnoDB: Uses event mutexes

2024-08-18 20:45:04 0 [Note] InnoDB: Compressed tables use zlib 1.3

2024-08-18 20:45:04 0 [Note] InnoDB: Number of pools: 1

2024-08-18 20:45:04 0 [Note] InnoDB: Using SSE2 crc32 instructions

2024-08-18 20:45:04 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M

2024-08-18 20:45:04 0 [Note] InnoDB: Completed initialization of buffer pool

2024-08-18 20:45:04 0 [Note] InnoDB: 128 out of 128 rollback segments are active.

2024-08-18 20:45:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables

2024-08-18 20:45:04 0 [Note] InnoDB: Setting file 'C:\xampp81\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...

2024-08-18 20:45:04 0 [Note] InnoDB: File 'C:\xampp81\mysql\data\ibtmp1' size is now 12 MB.

2024-08-18 20:45:04 0 [Note] InnoDB: Waiting for purge to start

2024-08-18 20:45:04 0 [Note] InnoDB: 10.4.32 started; log sequence number 3675669; transaction id 5108

2024-08-18 20:45:04 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp81\mysql\data\ib_buffer_pool

2024-08-18 20:45:04 0 [Note] Plugin 'FEEDBACK' is disabled.

2024-08-18 20:45:04 0 [Note] Server socket created on IP: '::'.



Solution 1 - Replace file from backup folder

That happened to me before and the solution was very simple for that. please Read all steps carefully :

  1. Make a backup for this folder C:\xampp\mysql\data (make sure your backup folder's name is not backup) .
  2. Now Copy all files/folders from C:\xampp\mysql\backup except ibdata1 to avoid error of table does not exist .
  3. Paste all copied files/folders to C:\xampp\mysql\data

Hope your problem will be solved.



Solution 2 - Replace previous ibdata1 file


The solution you applied essentially restored MySQL's system tables and some default configurations, but it might have affected the visibility of your existing databases. Since you've made a backup of the original data folder, your databases are likely still intact but not currently recognized by MySQL.

Here’s how you can recover your databases:

1. Restore the ibdata1 File

The ibdata1 file is crucial for InnoDB tables as it contains the data dictionary, which holds information about tables and indexes. If this file is not consistent with your current MySQL setup, the databases might not be visible.

  • Ensure that the ibdata1 file from your original backup (before you replaced files) is restored to C:\xampp\mysql\data.
  • If you skipped copying ibdata1 as part of the recovery steps, the InnoDB tables will not be recognized, which could be why your databases aren’t showing up.

2. Restore Your Original Database Folders

Your databases should have their own directories within the C:\xampp\mysql\data folder. If you replaced this entire folder with the backup content, your database directories might be missing.

  • Copy your database folders (from the backup you created initially) back to C:\xampp\mysql\data.
    • Each database should have its own folder named after the database itself, containing .frm, .ibd, .MYI, .MYD, etc., files.

3. Restart MySQL

After restoring the necessary files and folders:

  1. Stop MySQL from the XAMPP Control Panel.
  2. Start MySQL again.

4. Check Database Visibility

  • Go to phpMyAdmin and check if your databases are now visible.
  • If you don't see the databases, MySQL might need to be made aware of them again.

5. Force MySQL to Recognize the Databases

If your databases are still not showing up in phpMyAdmin, try the following:

Option 1: Manually Recreate Database Entries

  1. Create a New Database with the Same Name:

    • In phpMyAdmin, create a new database with the exact same name as your missing database.
    • This step regenerates the metadata, but the existing .ibd files in the data directory will link to the original data.
  2. Check the Tables:

    • After creating the database, check if the tables appear under the newly created database.

Option 2: Use the innodb_force_recovery Method

If the tables are still not showing up:

  1. Enable InnoDB Recovery Mode:

    • Open my.ini (located in C:\xampp\mysql\bin).
    • Under [mysqld], add:
      innodb_force_recovery = 1
    • Save the file and restart MySQL from the XAMPP Control Panel.
  2. Access phpMyAdmin:

    • Access phpMyAdmin to see if your databases are now visible.
  3. Disable InnoDB Recovery Mode:

    • Once your databases are visible, stop MySQL, remove the innodb_force_recovery line, and restart MySQL.

6. Verify Database Integrity

  • If your databases are visible, run a CHECK TABLE and REPAIR TABLE (if needed) on each table to ensure everything is in working order.

7. Backup Your Data

  • Once everything is restored, take a full backup of your databases using phpMyAdmin or by exporting them as .sql files to avoid any future issues.

If you still can't access your databases after following these steps, please share any error messages or issues that arise, and I can provide more targeted assistance.

Ulasan

Catatan popular daripada blog ini

SISTEM PENGOPERASIAN KOMPUTER (OS)

JENIS-JENIS SISTEM PENGOPERASIAN KOMPUTER

JENIS - JENIS ARAHAN SQL