【MySQL】mysqldumpでデータベースを指定してdumpする

1 |
mysqldump -uroot -p -h<hostname> -B <dbname> > test.sql |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
20 -- 21 -- GTID state at the beginning of the backup 22 -- 23 24 SET @@GLOBAL.GTID_PURGED=''; 25 26 -- 27 -- Current Database: `test` 28 -- 29 30 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET utf8 */; 31 32 USE `test`; 33 34 -- |
1 2 3 4 5 6 |
1 db: 2 image: mysql:latest 3 volumes: 4 - ./initdb.d:/docker-entrypoint-initdb.d 5 environment: 6 - MYSQL_ROOT_PASSWORD=root |