Encountered Problems During Installation
The steps below are based on MySQL 8.0.13, downloaded as a ZIP archive from the official MySQL website. For manual installation of the ZIP version, initialization is required after extraction. Use the following command:
mysqld --initialize --user=mysql --console
If the command fails, ensure you are running the command prompt with Administrater privileges. Successful initialization will generate a temporary root password in the console output, which must be noted and changed promptly after the first login.
Errors During Application Startup in Eclipse/IDEA
1. Authentication Protocol Mismatch
Error:
MySQLNonTransientConnectionException:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Cause: The MySQL JDBC driver is outdated and incompatible with MySQL 8.0's default authentication plugin.
Solution: Download the latest MySQL Connector/J driver. Select "Platform Independent" from the download page. Replace the old JAR file in your project's build path with the new one.
2. Deprecated Driver Class
Error:
Loading class `com.mysql.jdbc.Driver'. This is deprecated.
The new driver class is `com.mysql.cj.jdbc.Driver'.
The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Cause: The legacy driver class has been deprecated.
Solution: Update your database configuration. For example, in a properties file:
# Old configuration
db.driver=com.mysql.jdbc.Driver
# New configuration
db.driver=com.mysql.cj.jdbc.Driver
3. Unrecognized Server Time Zone
Error:
The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
You must configure either the server or JDBC driver (via the serverTimezone configuration property)
to use a more specific time zone value if you want to utilize time zone support.
Cause: The JDBC driver cannot interpret the server's default time zone setting.
Solution: Explicitly set the serverTimezone parameter in the connection URL. UTC is a common choice:
jdbc:mysql://localhost:3306/my_database?serverTimezone=UTC
4. Public Key Retrieval Restriction
Error:
Public Key Retrieval is not allowed
Cause: This often occurs when using the caching_sha2_password authentication plugin with certain client configurations.
Solution: Add the allowPublicKeyRetrieval=true parameter to your JDBC connection URL. Use it cautiously, typically in development environments.
jdbc:mysql://localhost:3306/my_database?serverTimezone=UTC&allowPublicKeyRetrieval=true