Is there any SQL (or PHP command) that can be used to either force a master to propagate changes to slaves and/or wait until the changes have been propagated to all slaves?
You can use the function SOURCE_POS_WAIT()
. Call this function in an SQL expression on the replica, and it will block (not return) until the replica has executed up to specified log file & position.
SELECT SOURCE_POS_WAIT('mysql-bin.000042', 8675309);
Before MySQL 8.0.26, use MASTER_POS_WAIT()
which was the old name for this function.