2
2
はじめての記事投稿
Qiita Engineer Festa20242024年7月17日まで開催中!

MySQLにエラーログもなくXAMPPでStartできなくなった時の備忘録

Posted at

MySQLの接続がすぐに切れる

プログラミングスクールに通い始め、XANPPでMySQLを使用した実習中に何度か起きたので記述します。
環境:Win11 XAMPP Control Panel V3.3.0

症状

スクリーンショット 2024-07-17 174623.png

MySQLのStartを押すとすぐに上記のエラーにより接続が止まってしまいました。いろいろなところでは、「エラーログの確認後~・・・」などの記事があり再起動などを試しましたがダメ。
エラーログを確認しても次の通りのログで、特にエラーは見られませんでした。

[Note] Starting MariaDB 10.4.32-MariaDB source revision c4143f909528e3fab0677a28631d10389354c491 as process 14072
[Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
[Note] InnoDB: Uses event mutexes
[Note] InnoDB: Compressed tables use zlib 1.3
[Note] InnoDB: Number of pools: 1
[Note] InnoDB: Using SSE2 crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: Setting log file C:\xampp\mysql\data\ib_logfile101 size to 5242880 bytes
[Note] InnoDB: Setting log file C:\xampp\mysql\data\ib_logfile1 size to 5242880 bytes
[Note] InnoDB: Renaming log file C:\xampp\mysql\data\ib_logfile101 to C:\xampp\mysql\data\ib_logfile0
[Note] InnoDB: New log files created, LSN=551966
[Note] InnoDB: 128 out of 128 rollback segments are active.
[Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
[Note] InnoDB: Creating shared tablespace for temporary tables
[Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
[Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
[Note] InnoDB: Waiting for purge to start
[Note] InnoDB: 10.4.32 started; log sequence number 552460; transaction id 1052
[Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
[Note] Plugin 'FEEDBACK' is disabled.
[Note] InnoDB: Cannot open 'C:\xampp\mysql\data\ib_buffer_pool' for reading: No such file or directory
[Note] Zerofilling moved table:  '.\mysql\plugin'
[Note] Zerofilling moved table:  '.\mysql\servers'
[Note] Server socket created on IP: '::'.

ただ、ウィンドウズビューアーの「管理イベントの要約」にてMariaDBでエラーが起きているようでした。詳細を見ると下記のようなエラーが出てました。

Fatal error: Can't open and lock privilege tables: Incorrect file format 'db'

どうもデータベース自体に問題が起こってそうでした。

実際にした操作

1.行った操作はC:\xampp\mysql\dataディレクトリを退避後(以後退避フォルダ)、中のファイルを全削除
2.C:\xampp\mysql\backupディレクトリ内をC:\xampp\mysql\dataディレクトリへコピー
3.XAMPP→MySQL起動を確認
(ここで起動できないようなら別に原因がありそうです
4.C:\xampp\mysql\dataディレクトリ内のmysql、performance_schema、phpmyadmin、testファルダ以外のファイルを削除
5.退避フォルダ内の上記のフォルダ以外(要は作成したDBフォルダ)とibdata1、myファイルを移動(myファイルは設定ファイルなので特に変えてないようなら、元ファイルで大丈夫そうですが、ibdata1はDBとの接続にかかわるファイルのため、必ず退避したファイルの物を置き換え)

破損したのが標準のDBだったのか、以上の操作で復旧できました。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2