3

我有这段代码可以将 CSV 文件上传到 MySQL,我尝试上传我创建的 CSV 文件,但是在运行代码时我不断收到此错误。

我试图运行的代码在这里:

Load Data Local Infile

'/Users/dylanpowell/Dropbox/Dylan Powell/Berkeley Investment Advisors/Dylans Stock Evaluations/Bottom Scores at 9-7-19.csv'

Into Table Stock_Evaluator_Raw_Scores 
    Fields Terminated by ','

    Enclosed by '"'

    Escaped by '\\'

    Lines terminated by '\n'
 Ignore 1 Lines; 

错误如下:

Error Code: 3948. Loading local data is disabled; this must be enabled on both the client and server side. Load Data Local Infile '/Users/dylanpowell/Dropbox/Dylan Powell/Berkeley Investment Advisors/Dylans Stock Evaluations/Bottom Scores at 9-7-19.csv'Into Table Stock_Evaluator_Raw_Scores Fields Terminated by ','Enclosed by '"' Escaped by '\\'Lines terminated by '\n' Ignore 1 Lines; 

我注意到这个问题还有另一个堆栈溢出,但我不确定如何实现这些方法来让我的代码运行。

4

1 回答 1

4
  1. 打开 MYSQL 命令行

  2. 输入您的密码

  3. 输入以下内容:

    显示像'local_infile'这样的全局变量;

  4. 如果 local_infile 值等于 false,则通过以下方式将其设置为 true:

    设置全局 local_infile = true;

更多信息在这里:https ://www.digitalocean.com/community/questions/how-to-enable-local-capability-in-mysql-workbench

于 2021-04-01T05:37:48.093 回答