我發現很多人有類似的錯誤,但沒有提示正在爲我的問題工作。Sqoop導入錯誤:訪問被拒絕用戶'root'@'localhost',即使權利正常
我的命令行:
sqoop import --connect jdbc:mysql://localhost/databaseY --username=root -P --table tableX --target-dir /user/ec2-user/databaseY/tableX --as-textfile --fields-terminated-by "\t"
錯誤
16/08/19 11:25:51 INFO mapreduce.Job: Job job_1471608424445_0028 running in uber mode : false
16/08/19 11:25:51 INFO mapreduce.Job: map 0% reduce 0%
16/08/19 11:25:58 INFO mapreduce.Job: map 25% reduce 0%
16/08/19 11:26:04 INFO mapreduce.Job: map 50% reduce 0%
16/08/19 11:26:06 INFO mapreduce.Job: Task Id : attempt_1471608424445_0028_m_000000_0, Status : FAILED
Error: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
它是如何可能的地圖開始,並且由於這個錯誤後停止?
它看起來像我有需要,因爲這兩個命令行中的所有正確正在:
sqoop list-databases --connect jdbc:mysql://localhost --username root -P
而且
在有root帳號MySQL的我可以做
select * from databaseY.tableX
- -EDIT ---
該命令行正在執行:
sqoop import --connect jdbc:mysql://localhost/databaseY --username root --password PASSWORD --query "select * from databaseY.tableX where number = 1474 AND \$CONDITIONS" --target-dir /tmp/ok --as-textfile --direct --split-by number
但是這一次沒有:
sqoop import --connect jdbc:mysql://localhost/databaseY --username root --password PASSWORD --query "select * from databaseY.tableX where 1 = 1 AND \$CONDITIONS" --target-dir /tmp/ok --as-textfile --direct --split-by number
然後,我意識到,如果我用-m 1我sqoop進口工作。僅限於-m 1
是否意味着我的集羣配置很差?爲什麼我的工作只能在一個地圖任務上工作?
----- SOLUTION -----
這只是一個IP地址的問題。我通過IP地址更改了localhost,現在工作正常。
你可以用'--username root'而不是'--username = root'來試試第一個命令嗎? –
是的,我嘗試了=或沒有但沒有改變。這不是兩個都有效 – Selverine