Java 需要 Spring Boot CLIENT_PLUGIN_AUTH
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53192560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring boot CLIENT_PLUGIN_AUTH is required
提问by DavElsanto
I have my app working fine on local, but when I tried to connect to remote server I get this error: CLIENT_PLUGIN_AUTH is required.
我的应用程序在本地运行良好,但是当我尝试连接到远程服务器时,出现此错误:需要 CLIENT_PLUGIN_AUTH。
server.port=8081
spring.jpa.hibernate.ddl-auto=none
#local
#spring.datasource.url=jdbc:mysql://localhost:3306/dbtest
#spring.datasource.username=user
#spring.datasource.password=password
#remote
spring.datasource.url=jdbc:mysql://userssh:[email protected]:3306/dbtest
spring.datasource.username=userRemote
spring.datasource.password=passRemote
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
采纳答案by DavElsanto
I got it.
我知道了。
Step 1. Create an user on remote mysql server and grant all privileges.
步骤 1. 在远程 mysql 服务器上创建一个用户并授予所有权限。
Step 2. Change datasource url
步骤 2. 更改数据源 url
spring.datasource.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/dbtest
Step 3. Change pom.xml mysql
步骤 3. 更改 pom.xml mysql
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
Check that version is changed to <version>5.1.6</version> from <scope>runtime</scope>
回答by P Satish Patro
you need to find a compatible version for your MySQL installed version
你需要为你的 MySQL 安装版本找到一个兼容的版本
Default one is
默认一个是
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
Change it to some version
改成某个版本
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
Now remove the default dependency installed. "package explorer"> your project > "Maven dependencies">type MySql it will come, now delete it(mysql-connector-java-x.y.z.jar)
现在删除安装的默认依赖项。“包资源管理器”>“你的项目”>“Maven 依赖”>输入 MySql 它会来,现在删除它(mysql-connector-java-xyzjar)
Try to give version nearer to your MySql version & check maven repositoryand find a nearer version having more usage
尝试提供更接近您的 MySql 版本的版本并检查Maven 存储库并找到更接近的使用更多的版本
For me, MySql version is 5.0.27 which you can see from "MySQL command line client" and the version I tried is 5.1.46
对我来说,MySql 版本是 5.0.27,你可以从“MySQL 命令行客户端”看到,我试过的版本是 5.1.46
1 more thing is to add in application.proerties
还有一件事是在 application.proerties 中添加
spring.datasource.driver-class-name= com.mysql.jdbc.Driver
But, if you are taking MySql dependency version nearer to 8 it is
但是,如果您将 MySql 依赖版本接近 8,则它是
spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver
which is not required as it takes internally
这不是必需的,因为它在内部需要
Now do "clean install" your app, right-click "run as">mvn clean & "run as">mvn install, then build your application using right-click "maven">update project(Alt+F5)
现在执行“全新安装”您的应用程序,右键单击“运行方式”>“mvn clean &”运行方式“> mvn install,然后使用右键单击“maven”>更新项目(Alt+F5)构建您的应用程序
Now to confirm version change, check maven dependency, mysql-connector-java-5.1.46.jar(your mentioned dependency)
现在确认版本更改,检查 maven 依赖项,mysql-connector-java-5.1.46.jar(您提到的依赖项)
And, if still not working make sure you have checked with some application having localhost server. Then check /etc/drivers/hosts file & uncomment this line
而且,如果仍然无法正常工作,请确保您已检查某些具有 localhost 服务器的应用程序。然后检查 /etc/drivers/hosts 文件并取消注释这一行
# 127.0.0.1 localhost
回答by Natty
Check if the following are configured correctly. This solved the problem for me. If you are new to Java environment then you should definitely look for these.
检查以下配置是否正确。这为我解决了这个问题。如果您不熟悉 Java 环境,那么您绝对应该寻找这些。
1) Check if the MySQL-connector-java driver version is suitable for the PySpark version that you are using. If not try changing it.
1) 检查 MySQL-connector-java 驱动程序版本是否适合您使用的 PySpark 版本。如果没有尝试改变它。
2) Make sure only one mysql-connector-java-.jar driver file is present in the folder that you are looking into. Remove the other versions from this location. There is a possibility that the other version is taken by PySpark
2) 确保您正在查看的文件夹中只有一个 mysql-connector-java-.jar 驱动程序文件。从此位置删除其他版本。另一个版本有可能被 PySpark 采用
4) Verify if your environment variable SPARK_HOME is set correctly. To check this, copy the location that was given in the environment variable window and paste it in the file explorer (Windows). This should go to the correct location.
4) 验证您的环境变量 SPARK_HOME 是否设置正确。要检查这一点,请复制环境变量窗口中给出的位置并将其粘贴到文件资源管理器 (Windows) 中。这应该转到正确的位置。
3) Confirm if your environment is using the mysql-connector-java-.jar driver file that you want it to use. One way to test this is to remove the file from this location and see if the error changes. If the same error (an error that was before deleting) occurs, then your environment is not using the driver file that you want it to use. Find the location of the file that your PySpark is using. Try changing this path (either by changing the environment variable or manually give the path in the code) or use this location and paste all the required driver files in that location
3) 确认您的环境是否正在使用您希望它使用的 mysql-connector-java-.jar 驱动程序文件。测试此问题的一种方法是从此位置删除文件并查看错误是否更改。如果发生相同的错误(删除之前的错误),则您的环境没有使用您希望它使用的驱动程序文件。找到您的 PySpark 正在使用的文件的位置。尝试更改此路径(通过更改环境变量或在代码中手动提供路径)或使用此位置并将所有必需的驱动程序文件粘贴到该位置
These were the checks I did and one of the above solutions should solve the issue provided there is nothing wrong with your code.
这些是我所做的检查,如果您的代码没有任何问题,上述解决方案之一应该可以解决问题。