0

コマンドラインからmysqlサーバーをシャットダウンしたい。

または強制的に使用taskkill.exeすると、mysqlサーバーが停止しますが、mysqlを再度起動すると。それが示している

2013-08-31 16:00:35 3940 [Note] InnoDB: Database was not shutdown normally!
2013-08-31 16:00:35 3940 [Note] InnoDB: Starting crash recovery.
2013-08-31 16:00:35 3940 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-08-31 16:00:35 3940 [Note] InnoDB: Restoring possible half-written data pages 
2013-08-31 16:00:35 3940 [Note] InnoDB: from the doublewrite buffer...
2013-08-31 16:00:35 3940 [Note] InnoDB: 128 rollback segment(s) are active.
2013-08-31 16:00:35 3940 [Note] InnoDB: Waiting for purge to start
2013-08-31 16:00:35 3940 [Note] InnoDB: 5.6.13 started; log sequence number 1600927
2013-08-31 16:00:35 3940 [Note] Recovering after a crash using mysql-bin
2013-08-31 16:00:35 3940 [Note] Starting crash recovery...
2013-08-31 16:00:35 3940 [Note] Crash recovery finished.

復旧には、実際にはサーバーの起動に時間がかかります。また、データベースが非常に大きい場合、起動に失敗することもあります。

だから私は通常のようにシャットダウンしたい:

mysqladmin -u root -pmysql shutdown

上記のコマンドは機能しますが、MySQL ルート パスワードが変更される可能性があるため、 Windows 用に以下の Mac OS Xの同様のコマンドが必要です。

mysqladmin -u root -p$(cat /path/to/mysql/root/password) shutdown

基本的に、ファイルからパスワードを読み取りたいです。DOSで可能ですか?

助けはありますか?ありがとう。

4

1 に答える 1

0

解決しました。

これがコマンドです

for /f "tokens=*" %f in ('type path\to\mysql\root\password.txt') do @(mysqladmin -u root -p%f shutdown)
于 2013-08-31T11:20:01.193 に答える