Use mysqldump command to backup / resotre MySQL database. The mysqldump command is included with MySQL installation.
Will explain two backup method.
1. How to back up only specific databases
2. How to back up all databases
To dump backup data from a specific MySQL database, use the following command:
$ mysqldump --single-transaction -u username -p DBname > output destination file name
やってみます。
mysql> mysqldump –single-transaction -u root -p test > /tmp/dump/test.dump
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysqldump –single-transaction -u root -p test > /tmp/dump/test.dump’ at line 1
あれ?????? これ、mysqlにログインしなくていいのかな。
[vagrant@localhost ~]$ mysqldump –single-transaction -u root -p test > /tmp/dump/test.dump
Enter password:
[vagrant@localhost ~]$
ほう、そういうことか。。
次はテーブルのバックアップもやりたいね。