CLIENT_PLUGIN_AUTH is required异常

段干靖
2023-12-01
  • 抛出CLIENT_PLUGIN_AUTH is required异常
    详细异常信息
java.lang.RuntimeException: java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

	at com.baomidou.mybatisplus.generator.config.DataSourceConfig.getConn(DataSourceConfig.java:153)
	at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.handlerDataSource(ConfigBuilder.java:278)
	at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.<init>(ConfigBuilder.java:141)
	at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:93)
	at com.mashibing.TestGenerator.testGenerator(TestGenerator.java:50)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)

  • 百度,说是MySQL jar包版本过高,和自己的MySQL数据库对应不上
  • 所以查一下自己mysql版本(5.0.91),然后更换一下jar包版本

原本jar包版本写的是

<scope>runtime</scope>

我修改之后的jar包版本写的是

<scope>5.0.91</scope>

和我一样是菜鸡的应该看不出来我写错了吧?你看出来我写错了,我就当你是大佬好了
应该正确写的jar包版本
注意:不是版本降低了就对,是scope不行,得写version,至于版本为什么降低,好像是不降低还不对,就继续降,

<version>5.0.8</version>

继续。。依旧报错。。报错原因没了。。不过是因为这个
数据源写错
com.mysql.jdbc.Driver
com.mysql.cj.jdbc.Driver
不同版本的Mysql配置不一样。
Mysql5.0版本的对应配置:
driverClassName属性对应的值为com.mysql.jdbc.Driver。

Mysql8.0+版本的对应配置:
driverClassName属性对应的值为com.mysql.cj.jdbc.Driver

没了----

 类似资料: