sqoop导入或导出出现Communications link failure错误

博客主要围绕Hadoop Sqoop在将localhost换成IP地址后,密码正确情况下的问题解决方法展开。具体步骤为进入数据库,修改数据库权限,将权限赋予root用户,IP地址可替换为节点映射名,最后刷新数据库权限。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

解决:把localhost换成IP地址
如执行后又出现以下问题
在这里插入图片描述
如果你的密码是对的后面就是yes
如果你的密码是错的后面就是no
这里说在密码情况是对的情况下的解决方法
1.进入数据库里面
2.修改数据库权限:grant all privileges on * . * to root@IP地址 identified by ‘MySQL密码’; 注:IP地址也可以改成你的Hadoop sqoop所在节点映射名
3.刷新数据库:flush privileges;

root@educoder:~# mysql -uroot -p123123 -h127.0.0.1 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.5.59-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE DATABASE hdfsdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) mysql> USE hdfsdb; Database changed mysql> CREATE TABLE student ( -> stu_no INT PRIMARY KEY, -> stu_name VARCHAR(20), -> stu_age INT -> ); Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO student (stu_no, stu_name, stu_age) VALUES -> (202001, 'zhangsan', 18), -> (202002, 'lisi', 19), -> (202003, 'wangwu', 20); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM student; +--------+----------+---------+ | stu_no | stu_name | stu_age | +--------+----------+---------+ | 202001 | zhangsan | 18 | | 202002 | lisi | 19 | | 202003 | wangwu | 20 | +--------+----------+---------+ 3 rows in set (0.00 sec) mysql> exit Bye root@educoder:~# sqoop import --connect jdbc:mysql://127.0.0.1:3306/hdfsdb --username root --password 123123 --table student; 25/03/28 11:17:03 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7 25/03/28 11:17:04 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 25/03/28 11:17:04 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 25/03/28 11:17:04 INFO tool.CodeGenTool: Beginning code generation 25/03/28 11:17:04 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `student` AS t LIMIT 1 2
03-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值