Fix bug upgrading from 2.x and add utf8 for mysql connection for upgrade