Database import for amazon rds: ERROR 2006 (HY000) at line 667: MySQL server is gone

When importing the database to my amazon rds instance, I was given the following error:

ERROR 2006 (HY000) at line 667: MySQL server has gone

I went ahead and tried to change the parameter interative_timeout

to a larger number. However, this will allow me to set this for session, and amazon does not allow setting it for global sessions.

How do I import a large database into my amazon rds instance?

+3


source to share


3 answers


The documentation provides instructions on how to import large datasets. Generally, the best way is to create flat files and import them into your RDS instance.



I recently completed migrating a database larger than 120GB from a physical server to RDS. I dumped each table into a flat CSV file and then split the large files into multiple 1GB chunks. Then I imported each table to RDS.

0


source


You can simply change the size setting of the RDS database using the options in the options group. Most of the MSQL settings are located there. However, this will require a restart of the instance. You want to install max_allowed_packet and you not only need to install it with the client, but also on the server itself.



0


source


This is how I did it, remember that my databases weren't very large (the largest was 1.5G).

First, dump the existing database:

mysqldump [database_name] --master-data=2 --single-transaction --order-by-primary -uroot -p | gzip > /mnt/dumps/[database_name].sql.gz

      

You can then transfer this file to an Amazon EC2 instance that has permission to access your RDS instance using something like scp . Once the file is on your Amazon EC2 instance, you should retrieve it using:

gzip [database_name].sql.gz -d
#you should now have a file named [database_name].sql in your directory.
mysql -uroot -p -h=[rds-instance]
source [database_name].sql

      

Then it should start importing. This information is in the documentation.

0


source







All Articles