InnoDB: Fehler: Protokolldatei ./ib_logfile0 hat eine andere Größe

InnoDB: Fehler: Protokolldatei ./ib_logfile0 hat eine andere Größe

Ich habe gerade die folgenden Zeilen in /etc/mysql/my.cnf hinzugefügt, nachdem ich eine Datenbank zur Verwendung der InnoDB-Engine konvertiert habe.

innodb_buffer_pool_size = 2560M
innodb_log_file_size    = 256M
innodb_log_buffer_size  = 8M
innodb_flush_log_at_trx_commit  = 2
innodb_thread_concurrency   = 16
innodb_flush_method = O_DIRECT

Aber es wird der Fehler "ERROR 2013 (HY000) at line 2: Lost connection to MySQL server while query" beim Neustart von mysqld angezeigt. Und das mysql-Fehlerprotokoll zeigt Folgendes an

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
100118 20:52:52 [ERROR] Plugin 'InnoDB' init function returned error.
100118 20:52:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
100118 20:52:52 [ERROR] Unknown/unsupported table type: InnoDB
100118 20:52:52 [ERROR] Aborting

Also habe ich diese Zeile auskommentiert

# innodb_log_file_size  = 256M

Und MySQL wurde erfolgreich neu gestartet.

Ich frage mich, was der „5242880 Bytes Protokolldatei“ bedeutet, der im MySQL-Fehler angezeigt wird. Es ist die erste Datenbank auf der InnoDB-Engine auf diesem Server. Wann und wo wird also diese Protokolldatei erstellt? Wie kann ich in diesem Fall die Direktive innodb_log_file_size in my.cnf aktivieren?

BEARBEITEN

Ich habe versucht, /var/lib/mysql/ib_logfile0 zu löschen und mysqld neu zu starten, aber es ist immer noch fehlgeschlagen. Im Fehlerprotokoll wird jetzt Folgendes angezeigt.

100118 21:27:11  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
InnoDB: Error: log file ./ib_logfile1 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!

Auflösung

Es funktioniert jetzt, nachdem sowohl ib_logfile0 als auch ib_logfile1 in /var/lib/mysql gelöscht wurden

Antwort1

InnoDB ist wahnsinnig wählerisch, was seine Konfiguration angeht; wenn etwas nicht stimmt, gibt es einfach auf und geht nach Hause. So ändern Sie die Größe der Protokolldatei ohne Datenverlust:

  1. Machen Sie alle an der Protokolldateigröße vorgenommenen Konfigurationsänderungen rückgängig und starten Sie MySQL erneut.
  2. In Ihrem laufenden MySQL: SET GLOBALinnodb_fast_shutdown=0;
  3. MySQL stoppen
  4. Nehmen Sie die Konfigurationsänderung an der Protokolldateigröße vor.
  5. Löschen Sie beide Protokolldateien.
  6. Starten Sie MySQL. Es wird sich über das Fehlen von Protokolldateien beschweren, diese aber erstellen und alles wird gut.

verwandte Informationen