此 MySQL 版本不允许使用的命令,即使我添加了 AllowLoadLocalInfile
The used command is not allowed with this MySQL version even if I add AllowLoadLocalInfile
我正在尝试使用 mysql bulkloader class,即使我将 AllowLoadLocalInfile=true 添加到我的连接字符串中,我也会收到以下错误。
错误:The used command is not allowed with this MySQL version e
byte[] byteArray = Encoding.ASCII.GetBytes(str1);
MemoryStream stream = new MemoryStream(byteArray);
using (MySqlConnection mConnection = new MySqlConnection("server=127.0.0.1;port=3306;database=testDB;uid=testUser;pwd=pass;AllowLoadLocalInfile=true;"))
{
MySqlBulkLoader bcp1 = new MySqlBulkLoader(mConnection);
bcp1.SourceStream = stream;
bcp1.TableName = "TableA";
bcp1.FieldTerminator = ",";
bcp1.LineTerminator = "\r\n";
bcp1.Local = true;
mConnection.Open();
bcp1.Load();
}
有谁知道我为什么会收到这个?
确保 local-infile
MySQL Server variable is set to ON
. By default, in MySQL Server 8.0.2 or later, it's OFF
, which disables LOAD DATA LOCAL
from any client; this is a security feature.
我正在尝试使用 mysql bulkloader class,即使我将 AllowLoadLocalInfile=true 添加到我的连接字符串中,我也会收到以下错误。
错误:The used command is not allowed with this MySQL version e
byte[] byteArray = Encoding.ASCII.GetBytes(str1);
MemoryStream stream = new MemoryStream(byteArray);
using (MySqlConnection mConnection = new MySqlConnection("server=127.0.0.1;port=3306;database=testDB;uid=testUser;pwd=pass;AllowLoadLocalInfile=true;"))
{
MySqlBulkLoader bcp1 = new MySqlBulkLoader(mConnection);
bcp1.SourceStream = stream;
bcp1.TableName = "TableA";
bcp1.FieldTerminator = ",";
bcp1.LineTerminator = "\r\n";
bcp1.Local = true;
mConnection.Open();
bcp1.Load();
}
有谁知道我为什么会收到这个?
确保 local-infile
MySQL Server variable is set to ON
. By default, in MySQL Server 8.0.2 or later, it's OFF
, which disables LOAD DATA LOCAL
from any client; this is a security feature.