Hello,
Currently, it is not supported to directly replace other versions of Mysql
It is recommended that you take a server snapshot first, and back up all databases, record all database names, users, passwords, and database encoding.
Delete all databases, uninsatll mysql, and finally install