Cómo migrar una base de datos MySQL a un endpoint existente de RDS Aurora MySQL

Escenario

Herramientas utilizadas

  • Toda la consolidación se hizo utilizando Cloud9 utilizando la terminal.

Solución paso a paso

Base de datos Origen

mysql -h MYENDPOINT.cluster-ID.us-east-1.rds.amazonaws.com -u databaseuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 167040453
Server version: 5.7.12 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>
mysqldump -h MYENDPOINT.cluster-ID.us-east-1.rds.amazonaws.com     -u MyUser     -p'MyPassword'     --port=3306     --single-transaction     --routines     --triggers     --databases  MyDatabase     --compress      --port 3306 MyDatabase.sql
mysqldump -h MYENDPOINT.cluster-ID.us-east-1.rds.amazonaws.com     -u MyUser     -p'MyPassword'     --port=3306     --single-transaction     --routines     --triggers     --databases  MyDatabase     --compress      --port 3306 | gzip -9 | aws s3 cp - s3://MyBucket/MyDatabase.sql.gz

Base de datos Destino

mysql -h MYENDPOINT_DESTINO.cluster-ID.us-east-1.rds.amazonaws.com -u databaseuser -p
CREATE USER 'MyUser_DESTINO'@'%' IDENTIFIED BY 'MyPassword_DESTINO';
CREATE DATABASE MyDatabase_DESTINO;
GRANT ALL PRIVILEGES on MyDatabase_DESTINO.* To MyUser_DESTINO@'%';
FLUSH PRIVILEGES;
mysql -h MYENDPOINT_DESTINO.cluster-ID.us-east-1.rds.amazonaws.com -u MyUser_DESTINO -MyPassword_DESTINO' MyDatabase_DESTINO < MyDatabase.sql
mysql> use MyDatabase_DESTINO;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------------------------------------------+
| Tables_in_MyDatabase_DESTINO |
+----------------------------------------------------------+
| MyTabla_1 |
| MyTabla_2 |
| MyTabla_3 |

Lecciones Aprendidas

--

--

--

AWS x10, Tech Director en Globant con más de 7 años de experiencia en AWS.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Carlos Andres Zambrano Barrera

Carlos Andres Zambrano Barrera

AWS x10, Tech Director en Globant con más de 7 años de experiencia en AWS.

More from Medium

BETWEEN A CADAVER AND A CADAVA-RER

With the Digital revolution around all businesses, small or large, corporates, organizations and…

My nordic fantasy in Norway