LoginSignup
0
0

More than 3 years have passed since last update.

MySQLにLinuxコマンドからエクスポート、インポートする方法

Posted at

よく忘れるのでメモ用。

特定のデータベースの中身を全てエクスポート

以下のコマンドをクリック。

mysqldump -u root -p testdb > dump.sql

以上の例では、
rootユーザー、testdbというデータベース名になります。
tesdbの中身を「dump.sql」というファイル名で出力します。

以上のコマンドを打った後、パスワードが求められます。

特定にデータベースsqlファイルをインポート

以下のコマンドをクリック。

mysql -u root -p testdb < dump.sql

以上の例では、
rootユーザー、testdbというデータベース名になります。
dump.sqlのファイルを、testdbにインポートします。

以上のコマンドを打った後、パスワードが求められます。

以上

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