gpt4 book ai didi

hadoop - 从sqoop远程访问mySql

转载 作者:行者123 更新时间:2023-12-02 21:21:46 25 4
gpt4 key购买 nike

我可以通过以下方式连接到远程服务器上的SQL实例

mysql -h ServerIP -u root -p dbNamE

但是,一旦我尝试使用以下命令通过Sqoop连接:
sqoop list-tables --driver com.mysql.jdbc.Driver --connect jdbc:mysql://IP:port/dbName --username userName --password password

它抛出此错误:
16/05/06 16:46:46 ERROR manager.SqlManager: Error reading database metadata: java.sql.SQLException: Access denied for user 'root'@'IP' (using password: YES)
java.sql.SQLException: Access denied for user 'root'@'IP' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:885)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.manager.SqlManager.listTables(SqlManager.java:520)
at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)
at org.apache.sqoop.Sqoop.run(Sqoop.java:148)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:184)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:226)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:235)
at org.apache.sqoop.Sqoop.main(Sqoop.java:244)
Could not retrieve tables list from server
16/05/06 16:46:46 ERROR tool.ListTablesTool: manager.listTables() returned null

我可以对此澄清一下吗?

我该如何解决?

最佳答案

验证您的连接用户名是否正确,例如,是否可以使用“-u root”直接连接到mysql,那么在与sqoop连接时,您应该使用相同的值作为用户名。

否则,当我未在hive-site.xml文件中配置用户名和密码时,也会收到类似的消息:它会尝试使用默认密码(可以在您的hive安装文件夹/ conf中找到此文件) 。

如果是这种情况,则只需在该文件中配置以下属性:

<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>userName</value>
<description>user name for connecting to mysql server</description>
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
<description>password for connecting to mysql server</description>
</property>

关于hadoop - 从sqoop远程访问mySql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37072074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com