2020年9月16日水曜日

xamppのMySQL(ポスグレ)がshutdownエラーで起動できない、タスクキルでもport変えても直らないのをようやく解決できた話。The story that I finally solved the problem that MySQL of xampp could not be started due to a shutdown error, and it could not be fixed by task kill or port change.

https://y-a-d.hatenablog.jp/entry/2020/01/28/183000 

シェアしました。

xamppのMySQLがshutdownエラーで起動できない、タスクキルでもport変えても直らないのをようやく解決できた話。

色んなサイトを見てもどうすることもできず、再インストールするしかなかったあの頃に終止符。

私がエラー出してたというよりは、周りが良く出してて助けて~って言われていた。なぜ私にそのエラーが出なかったのかは謎。

 

 

MySQLが同じようなエラーで起動できなくなって、多くのサイトで書かれている以下のようなことも試したけどダメだった人向け。以下を試してない人は試してからどうぞ。

私の場合は矢印以下の状況だったのでどれも無駄でした。くぅ~。

 

・他で起動しているMySQLのタスクをキルする

 →そもそも他のMySQLが起動していない

・port番号を変える

 →そもそもそのportを他が使っていないから無意味

・PC再起動

 →無意味

・管理者権限で起動

 →無味無臭

 

上記で解決できた人は大丈夫です。

 

xamppでMySQLが起動しない

MySQLをスタートさせようとするとすぐSTOPになり、以下のような文が吐き出される。

 

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

 

前回xamppを終了させるときに適切な手順を踏まなかったっぽい。ひえ~。

 

エラーログはこんな感じ。ほんの少ししか抜き出してないけど。

 

2020-01-24 19:30:00 13456 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 1835047
2020-01-24 19:30:00 16984 [Note] InnoDB: Dumping buffer pool(s) not yet started
2020-01-24 19:30:00 13456 [Note] Plugin 'FEEDBACK' is disabled.
2020-01-24 19:30:00 13456 [Note] Server socket created on IP: '::'.

何を言っているのかさっぱりわからないのでコピって検索。

 

dataフォルダを丸っと退避

数カ月かけてようやく解決。エラー出てた皆、大してDBの中身ないから時間も勿体ないし再インストールしとけとやっていたためですはい。再インストールに甘えていた毎日。

 

まずxamppフォルダ内にある「mysql\data」をまるまるっとどこかに退避。

 

dataフォルダ内の自分のDB以外削除

退避をさせたら、同じく「mysql\data」の中にある自分が作ったデータベース以外のフォルダとファイルを削除。怖いけどバックアップあるので思い切り削除。

 

削除対象のフォルダは以下

mysql

・performance_schema

phpmyadmin

・test

 

ファイルも消してね。

 

backupフォルダの中身を丸っとdataにコピー

mysql\backup」内のファルダやファイルをコピーして、「mysql\data」にペースト。

 

ここまで終わったらxamppを再起動。そしてMySQL起動。

 

恐らく起動に成功するはず!!!!しなかったらスイマセンお手上げです。

 

テーブルの中身を見れない

起動はしてもこれで終わりではない。DBにもアクセスできるが、多分元々あったテーブルにはアクセスできないと思う。

 

SELECT文流すと以下が出るはず。

 

#1932 - Table 'DB.TABLE' doesn't exist in engine

 

SHOW TABLESで見るとテーブルがあるのに、こう言われる。

そしたらまたMySQLはSTOPさせる。

 

退避させたdataからibdata1をコピってくる

最初に退避させたdataフォルダからibdata1という名前のファイルをコピー。

そして「mysql\data」にペースト。上書きしちゃう。

 

このibdata1ってファイル、ざっくりいうとこれまでのデータベースの情報が入っているみたい。だからbackupから取ってきたibdata1ファイルだと、今まで作ってきたテーブルとかの情報がないから存在しないよというエラーが出るんだと思う。

 

ので、起動できたからと安心して新しくDB作ったりすると元々あったDBを復元するのは困難を極めると思うので注意。

 

これでDBの復元もできてる!はず!!!

確認どうぞ!

 

これで復元できなかったら諦めて他の情報当たるか新しいDB作ってくらさい。

 

そもそもshutdownエラーを出さないためには

ちゃんとコントロールパネルで、MySQLのスタート&ストップを行うこと。

えいってパネル閉じたり、「Quit」を押すのは違うっぽい。

いつも私はえいってコントロールパネルを閉じてるんだけど、このエラー起きたことない。謎。自分の環境で再現できないエラーの解決すんのめんどくさすぎぃ!

 

 

 

portがどうとかタスクキルがどうとかっていう情報はたくさん出てきたんだけど、ここまでの解決手段はなかなかネット上で見つからなかったため(途中までとかならわりとあった)、今後の為に記録。こんなブログ誰が見るのかわからないけど。

 

英語のサイトだとけっこう似たような情報が書いてあったっぽい。ので、英語ができる人はすぐ解決できていそう。ひぃ~ひぃ~言いながら翻訳に頼りながら読みました、ぎえー。

 

 

私みたいな技術者でもなんでもない者がこういうものを書くのはおこがましいなと思いつつも、ネットの海で(恐らく)ただ一人書いてくれていた情報に救われたこともあるので……。

書くのって大事。

 

Add Star
  • 山根厚介 

    突然MySQLが起動しなくなったのですが,この記事の内容を試したら復活しました。助かりました。ありがとうございます。

  • 通りすがり

    全く同じ現象になりましたが、この記事を参考に試したところ無事データベースへの接続、中身も復活しました。ありがとうございます。

  • masa

    同じような感じになったので検索しておじゃましました。
    xamppインストールして、mysqlだけこんな感じになりまし。apacheのほうは全然大丈夫なんですけれども。

    記事助かります。参考にしたいと思います。

https://y-a-d.hatenablog.jp/entry/2020/01/28/183000


I shared it.


 2020-01-28

The story that I finally solved the problem that MySQL of xampp could not be started due to a shutdown error, and it could not be fixed by task kill or port change.

IT and programs

I couldn't do anything when I looked at various sites, and I had to reinstall it.


Rather than I was giving an error, I was told that the people around me would help me. It's a mystery why I didn't get that error.


 


 


For those who can't start MySQL with a similar error and have tried the following, which are written on many sites. If you haven't tried the following, please try it.


In my case, the situation was below the arrow, so it was useless. Kuu ~.


 


-Kill a MySQL task running elsewhere


→ No other MySQL is running in the first place


・ Change the port number


→ It is meaningless because no one else is using the port in the first place


・ PC restart


→ meaningless


-Start with administrator privileges


→ tasteless and odorless


 


Those who can solve the above are okay.


 


MySQL does not start with xampp

As soon as I try to start MySQL, it goes to STOP and the following statement is spit out.


 


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


 


It seems that I didn't take the proper steps the last time I quit xampp. Hie ~.


 


The error log looks like this. I've extracted only a few.


 


2020-01-24 19:30:00 13456 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 1835047

2020-01-24 19:30:00 16984 [Note] InnoDB: Dumping buffer pool (s) not yet started

2020-01-24 19:30:00 13456 [Note] Plugin'FEEDBACK' is disabled.

2020-01-24 19:30:00 13456 [Note] Server socket created on IP:'::'.



I have no idea what I'm talking about, so copy and search.


 


Evacuate the data folder entirely

It finally settled over a few months. Everyone who got an error didn't have much time to do it because the contents of the DB weren't there, and I had to reinstall it. Yes. Every day I was spoiled for reinstallation.


 


First, save "mysql \ data" in the xampp folder entirely somewhere.


 


Delete other than your own DB in the data folder

After saving, delete the folders and files other than the database you created in "mysql \ data". I'm scared, but I have a backup, so I deleted it.


 


The folders to be deleted are as follows


・ Mysql


・ Performance_schema


・ Phpmyadmin


・ Test


 


Delete the file as well.


 


Copy the contents of the backup folder to data

Copy the folder and files in "mysql \ backup" and paste them into "mysql \ data".


 


When you're done, restart xampp. Then start MySQL.


 


Probably it will start successfully! !! !! !! If you don't, I'm sorry.


 


I can't see the contents of the table

Even if it starts, this is not the end. I can access the DB, but I don't think I can access the original table.


 


The following should appear when the SELECT statement is sent.


 


# 1932 --Table'DB.TABLE' doesn't exist in engine


 


When I look at SHOW TABLES, there is a table, but it says this.


Then MySQL will stop again.


 


Copy ibdata1 from the saved data

Copy the file named ibdata1 from the first saved data folder.


Then paste it into "mysql \ data". I will overwrite it.


 


This ibdata1 file seems to contain the information of the database so far. Therefore, I think that the ibdata1 file fetched from backup will give an error that it does not exist because there is no information such as the table created so far.


 


So, if you create a new DB with confidence because you can start it, it will be extremely difficult to restore the original DB, so be careful.


 


Now you can restore the DB! Should be! !! !!


Please check!


 


If you can't restore it with this, give up and hit other information or create a new DB.


 


In order not to get a shutdown error in the first place

Start and stop MySQL properly in the control panel.


It seems different to close the panel or press "Quit".


I always close the control panel, but I've never had this error. A mystery. Solving errors that can't be reproduced in my environment is too annoying!


 


 


 


I got a lot of information about port and task kills, but I couldn't find a solution so far on the net (it was halfway through), so I recorded it for the future. I don't know who will see this blog.


 


It seems that similar information was written on the English site. So, if you can speak English, it seems that you can solve it immediately. Hi ~ hi ~ I read while saying and relying on the translation, Gie.


 


 


I thought it would be awkward for someone like me to write something like this, but I was saved by the information that was (probably) the only one who wrote it on the internet.


Writing is important.


 


y-a-d 231 days ago



0 コメント:

コメントを投稿