Preparing Database for migration
- Database Engine : mysql
- Simulated Environment: mysql running on ubuntu VM on cloud
Steps for creation
- Create a ubuntu vm in aws/azure
- Now login into the vm and execute the following commands. Refer Here for steps
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
SELECT user,authentication_string,plugin,host FROM mysql.user;
CREATE USER 'qtdevops'@'%' IDENTIFIED BY 'motherindia@123';
GRANT ALL PRIVILEGES ON *.* TO 'qtdevops'@'%' WITH GRANT OPTION;
exit
sudo mysql -u qtdevops -p
- Lets import sample database Refer Here and the database is present over here. Login into ubuntu machine and execute following
cd ~
git clone https://github.com/datacharmer/test_db.git
cd test_db
mysql -u qtdevops -p < employees.sql
- Also import the data from here
- To view the database tables we would be install phpMyadmin Refer Here
Database Migration Strategies
- Offline:
- Take the data backup from the source database
- Transfer the backup to the destination
- Create/Update the Target Database with the backup
- Online:
- In online mode We have two approaches
- One is using the target database as a replication from the current source databse (DBA)
- Second option is to use the cloud provided migration tools like Database Migration Service