在我的Ubuntu
VM上,我试图使用以下脚本将多个文件添加到sql数据库中
#!/usr/bin/env bash
cd ~/spark-2.4.0-bin-hadoop2.7/data/retail-data/by-day/
for file in *.csv
do
echo "inserting file '$file'"
sudo mysql -e "LOAD DATA LOCAL INFILE '"$f"' INTO TABLE sales_hour FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS" -u=root retail_data
done
但我遇到错误
ERROR 1045 (28000): Access denied for user '=root'@'localhost' (using password: NO)
我该如何解决?
答案 0 :(得分:1)
-u
参数不包含=
:使用-u root
或-uroot