25
22

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 5 years have passed since last update.

MYSQLのバックアップとリストア

Last updated at Posted at 2014-06-13

1.データベースのダンプファイルを生成します。
mysqldump -u[MYSQL_USER_NAME] -p[PASSWORD] [DB_NAME] > [DB_DUMP_FILE_PATH]

2.リストア先のデータベースを作成します。
CREATE DATABASE [DB_NAME] DEFAULT CHARACTER SET utf8;

3.リストア先のデータベースユーザと権限を設定します。
GRANT ALL PRIVILEGES ON [DB_NAME].* TO [MYSQL_USER_NAME]@localhost IDENTIFIED BY '[PASSWORD]';

4.データベースのリストアを行います。
mysql -u[MYSQL_USER_NAME] -p[PASSWORD] [DB_NAME] < [DB_DUMP_FILE_PATH]

以上です。

25
22
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
25
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?