How to upgrade to MySQL 8.0?

Basically mysql-apt-config_0.8.12-1_all.deb is a package which adds MySQL's repository and key. It seems while installing this package you made wrong choices somewhere. You can do what that deb package do manually.

  • First of all create a new text file with sudo privileges:

    sudo nano /etc/apt/sources.list.d/mysql.list
    
  • Add these lines:

    deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
    deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0
    deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
    #deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools-preview
    deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0
    

    You can comment/uncomment the repository according to the packages required. Save and exit using Ctrl+X followed by Y.

  • If you're using some other version of Ubuntu, you should replace bionic with the codename of your currently installed Ubuntu system using sed.

    sudo sed -i 's/bionic/'$(lsb_release -sc)'/' /etc/apt/sources.list.d/mysql.list
    

    Then run

    sudo apt update
    
  • You'll get an error, like

    Err:1 http://repo.mysql.com/apt/ubuntu bionic InRelease                        
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY <some key value>
    
  • Add this key using

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <key value>
    
  • Update and install MySQL

    sudo apt update
    sudo apt install mysql-server
    

Notes:

  1. Ubuntu 19.10 has MySQL 8.0 in its official repositories, therefore, there's no need to add the above sources unless latest updates are required.
  2. If the above method is followed and still APT installs MySQL v5.7, it may happen that MySQL has taken down the repository information for that release even before that release reaches the end of public support. See my other answer on Can't install MySQL 8 on Ubuntu 19.04 for details.