错误1045(28000):用户'= root'@'localhost'的访问被拒绝(使用密码:否)

时间:2019-01-21 06:46:59

标签: mysql

在我的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)

我该如何解决?

1 个答案:

答案 0 :(得分:1)

-u参数不包含=:使用-u root-uroot