首先,我尝试导入日期格式为mm-dd-yyyy的csv文件,而MySQL不希望这样做。我被要求在命令提示符下使用加载数据。
所以我在下面键入此命令,并显示以下错误:
load data infile 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\Square Items Sales History.csv' into table squarereport fields terminated by ',' ignore 1 lines (@saleDate,saleTime,category,Item,ItemQty,ItemSubName,GrossSales,Discounts,NetSales,customerID,customerName,HourOfTheDay,EventType,SaleCount) set saleDate = STR_TO_DATE(@saleDate, '%m/%d/%Y');
错误1290(HY000):MySQL服务器正在使用--secure-file-priv选项运行,因此它无法执行此语句
现在,我打开my.ini并添加了
[mysqld] secure-file-priv =“”
然后重新启动服务器。
奇怪的是,我仍然看到此消息:
SHOW VARIABLES LIKE "secure_file_priv"
# Variable_name, Value
'secure_file_priv', 'C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Uploads\\'
大便失禁,我尝试使用本地选项。
mysql> set global local_infile = true;
Query OK, 0 rows affected (0.00 sec)
mysql> load data local infile 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\Square Items Sales History.csv' into table squarereport fields terminated by ',' ignore 1 lines (@saleDate,saleTime,category,Item,ItemQty,ItemSubName,GrossSales,Discounts,NetSales,customerID,customerName,HourOfTheDay,EventType,SaleCount) set saleDate = STR_TO_DATE(@saleDate, '%m/%d/%Y');
ERROR 1148 (42000): The used command is not allowed with this MySQL version
我只想导入该CSV文件。是的,我已经尝试为日期和导入创建一个“字符串”变量,但该死的工作台加载得太慢了!!!