퍼블릭 클라우드
Amazon RDS mysql(mariadb) 데이터베이스 마이그레이션
변군이글루
2020. 10. 20. 15:25
반응형
Amazon RDS mysql(mariadb) 데이터베이스 마이그레이션
[소스 데이터베이스(sdb.sangchul.kr)]
데이터베이스 접속 테스트
mysql -hsdb.sangchul.kr -umyuser -p'mypassword1!' mydata_DB
$ mysql -hsdb.sangchul.kr -umyuser -p'mypassword1!' mydata_DB
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 123456789
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit
Bye
AWS RDS 데이터 익스포트(Export)
mysqldump -hsdb.sangchul.kr -umyuser -p'mypassword1!' --databases mydata_DB > mydata_DB_20201020.sql
$ mysqldump -hsdb.sangchul.kr -umyuser -p'mypassword1!' --databases mydata_DB > mydata_DB_20201020.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions,
even those that changed suppressed parts of the database.
If you don't want to restore GTIDs, pass --set-gtid-purged=OFF.
To make a complete dump, pass --all-databases --triggers --routines --events.
[타켓 데이터베이스(tdb.sangchul.kr)]
데이터베이스 접속 테스트
mysql -htdb.sangchul.kr -umyuser -p'mypassword1!'
DB(mydata_DB) 생성
mysqladmin -htdb.sangchul.kr -umyuser -p'mypassword1!' create mydata_DB
익스포트(Export)한 sql 파일(mydata_DB_20201020.sql)을 임포트(Import)
mysql -htdb.sangchul.kr -umyuser -p'mypassword1!' mydata_DB < mydata_DB_20201020.sql
$ mysql -htdb.sangchul.kr -umyuser -p'mypassword1!' mydata_DB < mydata_DB_20201020.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
임포트(Import)한 데이터베이스 테이블 확인
mysql> show tables from mydata_DB;
728x90
반응형