0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MySQLdumpでバックアップ【warning】using a password on the command line interface can be insecure

Last updated at Posted at 2020-08-14

MySQLdumpでバックアップ【warning】using a password on the command line interface can be insecure

MySQLdumpでバックアップする基本構文でパスワードが直書きされているとのエラーが。
どうやらSQLコマンドにパスワードを直書きすると注意されるらしい。

mysqldumpの基本構文は以下。

mysqldump -u[ユーザー名] -p[パスワード] -h[ホスト名] [データベース名] [テーブル名1], [テーブル名2],...[オプション] > [保存先ファイル名]

調べたところ、パスワードを外部ファイルに保存するなどの方法もありましたが、次の方法でOK

mysqldump -u[ユーザー名] -p -h[ホスト名] [データベース名] [テーブル名1], [テーブル名2],...[オプション] > [保存先ファイル名]
パスワード欄は空欄にして打ち込みENTERを押すと

ENTER passwordという表記になるのでそこでパスワード入力。
保存先ファイル名は保存したい名前を入力。

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?