gpt4 book ai didi

mysql - 即使连接参数中提供了远程服务器 IP,Sqoop 导入也始终尝试连接到本地 mysql

转载 作者:行者123 更新时间:2023-11-29 17:39:14 25 4
gpt4 key购买 nike

即使连接参数中提供了远程服务器 IP,Sqoop 导入也始终尝试连接到本地 mysql

我在下面尝试使用 MySQL 连接到远程 MySQL 服务器,它工作正常。我能够探索表格。

mysql -u anuser -h 1.133.23.58 -p

当尝试下面的代码时,它尝试使用“anuser”连接到本地 MySQL 实例,“anuser”是远程 MySQL 实例的用户。

sqoop-import -m 1 
--driver com.mysql.jdbc.Driver \\
--connect jdbc:mysql://1.133.23.58:3306/misp \
--username anuser \
--password password \
--query "select id, CURDATE() as ref_date, v, score, type, feed from AnDomains where \$CONDITIONS" \
--split-by id \
--hive-drop-import-delims \
--hive-import \
--hive-table testdb.andomains \
--target-dir andomains

但是我可以成功连接到sqlserver数据库并将数据提取到hive表

错误信息:

18/04/29 15:05:15 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
18/04/29 15:05:15 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/04/29 15:05:15 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
18/04/29 15:05:15 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
18/04/29 15:05:16 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
18/04/29 15:05:16 INFO tool.CodeGenTool: Beginning code generation
18/04/29 15:05:16 ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: Access denied for user 'anuser'@'120.0.0.1' (using password: YES)
java.sql.SQLException: Access denied for user 'ansuser'@'120.0.0.1' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927)

最佳答案

您需要从请求连接的主机向用户提供访问权限。在 mysql 命令提示符中执行以下命令:

GRANT ALL PRIVILEGES ON *.* TO 'ansuser'@'120.0.0.1' identified by 'passwordhere';

关于mysql - 即使连接参数中提供了远程服务器 IP,Sqoop 导入也始终尝试连接到本地 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50085184/

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