How can Upgrade MySQL 5.5.40 to MySQL 5.7

matinict picture matinict · Oct 21, 2014 · Viewed 67.6k times · Source

How can I Upgrade MySQL version

Current MySQL Version: 5.5.40

Target MySQL Version: MySQL 5.7

OS: CentOS release 6.5 (Final)

Answer

Alex picture Alex · Oct 17, 2016

Probably the quickest way is to dump your older DB version with mysqldump and restore it into 5.7 fresh DB.

How smooth the process goes, depends on how many dropped features in 5.7 you're using in 5.5.

In my case, the only feature, that was dropped in 5.7 was timestamp default '0000-00-00 00:00:00' The fix for that was to run sed on dump file and replace ''0000-00-00 00:00:00' with CURRENT_TIMESTAMP

sed -i.bu 's/'\''0000-00-00 00:00:00'\''/CURRENT_TIMESTAMP/g' fixed_dumo.sql

Afterthat, the fixed_dump.sql was imported into fresh 5.7 DB and it worked smoothly. I hope this helps.