MySQL 5.6 to 5.7 In-Place Upgrade or Fresh Install

amazon-rdsawsMySQLmysql-5.6upgrade

I'm preparing to migrate a production database server on AWS RDS to 5.7 from version 5.6.

I'm not sure that I trust the automatic upgrade service. Obviously, I would make a backup prior to doing anything, but is there any reason one should choose to just start a new instance and manually export / import the data (and privileges, of course)?

Best Answer

For such major version change like 5.5 to 5.6 or 5.6 to 5.7 I recommend to export/import rather than in-place.

Why do I prefer fresh-install rather than in-place? :

  • In MySQL 5.6 you have 29 tables under mysql schema and in 5.7 you have 33 tables under mysql schema.
  • If you are using GTID then it is not recommended to go for in-place upgrade.
  • Deprecated commands or data types.
  • Deprecated UDFs or changed functions.
  • Chances of password incompatibility.
  • Deprecated stuff will be thrown out as an error during import, thus gives us alarm. Though we don't go through white paper properly.

How do I proceed? :

Let's say in your case 5.6 to 5.7, on your test bed:

  1. Take mysqldump or mydumper with master status. A consistent backup.
  2. Take all grants out separately into an sql file.
  3. Have fresh installation of 5.7.
  4. Without performance_schema, mysql, information_schema or any system schema, import the dumped data into 5.7 and apply grants. Ensure you verify root and admin users are removed as it is a different server.
  5. Now create slave link and go for down time on 5.6.
  6. Now your test architecture will look like:

    APP- > 5.6 SERVERA (Master of) -> 5.7 SERVERB (Master of)  -> 5.7 SERVERC (Slave of SERVERB)
    
  7. And now do a consistency check of ServerA, ServerB, ServerC by considering frequently updating tables and take the data in chunk sets and verify if the data checksum is same as per its right state of changes.

But before everything we should ask ourselves what is the reason behind to go for different versions. Of course we can make use of new features. But if we verify conflicts in test bed at least we have a ground confidence to do the same to production.