502 Bad Gateway after strapi switch database

Alternatively I would suggest using MariaDB instead of MySQL which will not have the new MySQL auth method: https://linuxize.com/post/how-to-install-mariadb-on-ubuntu-18-04/

It’s a drop in replacement for MySQL and is supported by Strapi.