When you run a query against a MySQL database, MySQL uses a bunch of system variables to determine which character set and collation to use whenever queries are run. If the client uses a different character set to the server, then MySQL can translate it into an appropriate character set and collation.
When sending the query results back to the client, MySQL can translate these results back to a different character set altogether if required. MySQL uses system variables to determine which character sets and collations to use at each of these steps.
The following singles out the connection collation:
SELECT @@collation_connection;
Example result:
+------------------------+ | @@collation_connection | +------------------------+ | utf8mb4_0900_ai_ci | +------------------------+