sql >> Base de Datos >  >> RDS >> Mysql

Mover la base de datos mysql de un servidor a otro servidor

Si su sitio no es un sitio activo y el tiempo de inactividad no es un problema, puede intentar lo siguiente

#step1: take a dump of your db
>mysqldump –-user root –-password=myrootpassword db_test > db_test.sql

#step2: zip the .sql file - this is optional
>gzip db_test.sql

#step3: transfer the file to AWS using .pem file
>scp -i myAmazonKey.pem db_test.sql.gz [email protected]<ur_ip_address>:~/.

#step4: login to your AWS instance 

#step5: unzip the file
>gunzip db_test.sql.gz

#step6: import the db to your AWS mysql instance
>mysql -u username -p password db_name < db_test.sql