Importing a DB into AWS RDS DB - mysql

I want to import a mySQL DB into an AWS mySQL DD by using a sql file that I previously exported from another DB,
I am using Sequel Pro but I take ages. I would like to know if there is a faster way to do it, like uploading directly the sql file to AWS instead of using Sequel Pro

Yes, It will take time because you are making the import via client tool and this transmission is happening over the public internet. Best and secure way to import the database are
1 - Create a Dedicate EC2 instance in the same VPC of RDS
2 - Zip the backup file using the best compression tool to Decrease the Size and ship it to EC2 instance directly via SCP
3 - Once Shipping Process completed, Unzip the backup file and Import using Traditional import command. This import process will happen over private networks
mysql -u username -ppassword database_name table_name(Optional) -h endpoint of RDS

Related

Does AWS RDS support two way replication with local MySQL database?

I would like to sync the local MySQL database to Amazon RDS MySQL database. I found a solution for EC2 to RDS but not for Local Database to RDS.
I built a database including 12 tables which all I want to get backup them to cloud periodically or automatically.
I do not want to run EC2 server since I need only MySQL database to get backup on cloud.
I need a solution like Microsoft Database Sync Agent. Whenever changes detected in Local Database, it should be synced to the cloud database. How can I make this happen?
You could use the AWS Database Migration Service:
AWS Database Migration Service (AWS DMS) is a cloud service that makes it easy to migrate relational databases, data warehouses, NoSQL databases, and other types of data stores. You can use AWS DMS to migrate your data into the AWS Cloud, between on-premises instances (through an AWS Cloud setup), or between combinations of cloud and on-premises setups.
With AWS DMS, you can perform one-time migrations, and you can replicate ongoing changes to keep sources and targets in sync.
You can achieve this by following below steps.
Make a replica of local server to RDS.
Enable Query logging in local Database
Create a cron job which will process logging queries and it will execute queries on RDS instance in same order.
To generate a replica to RDS you can follow below steps.
You can't replicate your local database to RDS directly. Your need to dump you data and then after you can import it on RDS.
Instead of generating a dump file you can directly import data into RDS using below command.
mysqldump db_name | mysql -h 'other_hostname' db_name
You can find our more about this over here.
https://dev.mysql.com/doc/refman/5.7/en/copying-databases.html
Also first import tables & it's data then after import your triggers, routines & events. If you import together then there is a chances to get conflict and you job will be terminated.

Import/Export mysql between two remote hosts over SSH

I'm using RDS on Amazon and need a way to import a large database of over 3TB over to Google SQL Cloud.
The biggest problem here is time -- I need this to happen quickly. It doesn't feel right having to compress 3TB of data into a single .sql file, move it to an s3 bucket and then import that huge file into Google - which is what they seem to prefer you to do.
Apparently AWS doesn't let you create an image and move it to S3, so I can't then import that image over into Google.
Also, there doesn't seem to be a method to do a mysqldump / import from a remote sever via the Google Cloud Console.
Has anybody faced the same issue and is there a quick a direct way of approaching this?
After many hours of searching around, I was able to use an exising AWS instance to act as a proxy between the two remote SQL servers.
After allowing access to the Google SQL server (entering the IP for an AWS machine under the 'authorization' tab) you can connect to both remote servers and use something like this to directly copy each database table over:
mysqldump -h yourdatabase.rds.amazonaws.com -u user -ppassword awsdbtable --compress --single-transaction | mysql --host=YourGoogleSQL_IP --user=dbuser --password=dbpassword googledbtable

Routinely pull data from remote database to local

Is there a simpler approach to routinely keep a local MySQL database updated with data from a remote database? My setup needs me to run a local copy of the project in the office network to allow local email sending. But the emails link back to a live server. Also, the admin users need to access the project from the internet anywhere to compose the emails. Currently, my options are:
Connect local project to the remote database.
Export the remote database, clean the local database and then import the dump.
This is something I need to routinely do every week. I went with approach #1 but it takes a long time to pull data this way. So I am really wondering if I should do this in the long run?
On routine basis, just do the mysqldump export on remote server and then on local server do mysqldup import or mysql import.
mysqldump -u root-proot -h remote-server test > db%FileDate%.sql
And on local server, do the import
mysql -u root-proot -h local-server test < db%FileDate%.sql
You can use mysql incremental backup. Please refer below link.
https://www.percona.com/forums/questions-discussions/percona-xtrabackup/10772-[script]-automatic-backups-incremental-full-and-restore
https://dev.mysql.com/doc/mysql-enterprise-backup/8.0/en/mysqlbackup.incremental.html

Connecting lost during importing large data

I am trying to import large data table, around 1 billion record into MySQL(Amazon RDS) with a single .sql file by using source <.sql file>. During operation it is breaking connection.
How can I make it possible?
Thanks
One way to do it is to import the data into a mysql database locally, shut down the database server, then use import it into an amazon EC2 instance, then use replication to synchronize it to RDS. This is from the Amazon documentation on importing a large database to RDS.

A Simple Database Backup for MySQL Database on diff host (computer)

Can someone please tell me how to do a Simple Database Backup for MySQL Database on diff host (computer). I am trying to move my database from one host (server) to a new host (server)
If you just need to transfer a database between servers, using phpMyAdmin, you can use Export on the database on the source to generate a .SQL script, and then use Import on the target server to transfer it.
Alternatively, if the database is too big, you could use something like SQLDumper.