MySQL :: MySQL 8.4 C API Developer Guide :: 5.4.66 mysql_reset_server_public_key() (original) (raw)
The world's most popular open source database
5.4.66 mysql_reset_server_public_key()
void
mysql_reset_server_public_key(void)
Description
Clears from the client library any cached copy of the public key required by the server for RSA key pair-based password exchange. This might be necessary when the server has been restarted with a different RSA key pair after the client program had calledmysql_options() with theMYSQL_SERVER_PUBLIC_KEY
option to specify the RSA public key. In such cases, connection failure can occur due to key mismatch. To fix this problem, the client can use either of the following approaches:
- The client can callmysql_reset_server_public_key() to clear the cached key and try again, after the public key file on the client side has been replaced with a file containing the new public key.
- The client can callmysql_reset_server_public_key() to clear the cached key, then callmysql_options() with the
MYSQL_OPT_GET_SERVER_PUBLIC_KEY
option (instead ofMYSQL_SERVER_PUBLIC_KEY
) to request the required public key from the server Do not use bothMYSQL_OPT_GET_SERVER_PUBLIC_KEY
andMYSQL_SERVER_PUBLIC_KEY
because in that case,MYSQL_SERVER_PUBLIC_KEY
takes precedence.