mysql – Best way to start Master – Slave replication

I’m trying to get replication set up between two servers with the eventual goal of switching the slave over to be the master (I’m trying to upgrade the hardware stack with as little interruption as possible as well as upgrading from 5.7 to 8).

Current server is not configured as a master and does not have binary logging enabled.

Been readying different methods of doing it and the best I’ve come up with:

  1. Stop the server
  2. Export the database
  3. Restart the server with Binlog enabled
  4. Import the database to new server
  5. Restart with Master-slave relationship enabled once the full database is imported

My understanding is that the slave will be able to use the binlog to catch up the transactions to current, and I’m hoping this will lead to minimal down time. Having never tried it before I just wanted to know if there’s a better way to accomplish this andor if it will work as expected (especially with the binlog)