Onga inc

subtitle

mysqlで、データベースをバックアップ/復元をする

mysqlで、データベースをバックアップ/復元をする方法を解説します。

バックアップ

MySQLの特定のデータベースのデータを dump バックアップする

`mysqldump -u DBユーザ名 -p DB名 > 出力先ファイル名
`

MySQLの特定のデータベースのデータを dump バックアップする データベース定義のみ
-dオプション

`mysqldump -u DBユーザ名 -p DB名 -d  > 出力先ファイル名
`

MySQLの全てのデータベースをバックアップする方法

`mysqldump -u root -p -x --all-databases > 出力ファイル名
`

復元

特定のデータベースのみ復元する方法

`mysql -u ユーザー名 -p データベース名 < dumpファイル名
`

全てのデータベースを復元する方法

`mysql -u ユーザー名 -p < dumpファイル名
`

Onga

A designer, developer and entrepreneur. Spends his time travelling the world with a bag of kites. Likes journalism and publishing platforms.

Comments