Public Key Retrieval Error Occurs When Data Is Imported to MySQL
Symptom
When data is imported to MySQL, a public key retrieval error occurs and the message "Public Key Retrieval is not allowed" is displayed.
Key Process and Cause Analysis
When MySQL 8.0 uses the caching_sha2_password plugin for authentication, the public key is required for encryption. The MySQL client (such as Connector) must be able to retrieve the public key. If the client is not correctly configured to allow public key retrieval, this problem occurs.
Conclusion and Solution
Configure client connection options and enable public key retrieval.
- Open the my_mysql.properties file.
vi my_mysql.properties
- Press i to enter the insert mode and add the following configuration to jdbc:
allowPublicKeyRetrieval=true
See the following figure for the added content:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the data loading command again.
./runDatabaseBuild.sh my_mysql.properties
Parent topic: Troubleshooting