Upgrade MySQL 5.7 to MySQL 8

To upgrade in Ubuntu 18.04 server.

Step I: Get the upgrade command shell and check upgrade issues
Get the MySQL Shell download link here: https://dev.mysql.com/downloads/shell/
This shell will assist in finding issues with the current installation.

Install the MySQL upgrade shell with the command

dpkg -i mysql-shell_8.0.30-1ubuntu18.04_amd64.deb

This will make available the mysqlsh command. Execute this mysqlsh command with root user to access the MySQL JS shell.

mysqlsh

Inside the shell execute the command

MySQL  JS> util.checkForServerUpgrade("root@localhost:3306",{"configPath":"/etc/mysql/my.cnf"});

This will check for both the database table conditions and also the system variable specified on my.cnf. Follow through on the errors specified. For my installation, the following changes were suggested.

innodb_file_format - is set and will be removed
innodb_large_prefix - is set and will be removed
query_cache_limit - is set and will be removed
query_cache_size - is set and will be removed
query_cache_type - is set and will be removed
default_authentication_plugin=mysql_native_password

The setting default_authentication_plugin=mysql_native_password was added and the remaining removed from my.cnf.

Step II: Get the MySQL Apt Repository

Download the MySQL apt repo from Oracle downloads list here: https://dev.mysql.com/downloads/repo/apt/
Install this repo with the command

dpkg -i mysql-apt-config_0.8.23-1_all.deb

Step III: Install MySQL Server 8.0

Shutdown mysql process

sudo service mysql stop

Perform an update .

sudo apt-get update && sudo apt-get upgrade

Most likely the 8.0 version mysql-server and mysql-common packages will not auto-install. Install it by manually specifying

sudo apt-get install mysql-server mysql-common

This will install the MySQL Server. Takes sometime but the installation complete. Check the new MySQL version with the command

mysql --version