我要评分
获取效率
正确性
完整性
易理解

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.

  1. Open the my_mysql.properties file.
    vi my_mysql.properties
  2. Press i to enter the insert mode and add the following configuration to jdbc:
    allowPublicKeyRetrieval=true

    See the following figure for the added content:

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