When MySql database upgrade to 8 above, for developers very easy to use tool for batch import data using loaddata there will be some minor problems.
Here briefly summarize, if you can help you save time better and better the
Simple and crude, around out what was wrong, why, how to solve the three-point start text
错误:ERROR 1148: The used command is not allowed with this MySQL version
Why: load data local high-risk vulnerabilities may be utilized, so that more than 8 change function is disabled by default mysql
Zaban: modify global variables enable load data
set global local_infile = 1;
Modify config Enables load data local
[client] loose-local-infile = 1
Error: MySqlBulkLoader reported promissions deny
Why: Before 5.6, this code is no problem, after version 5.6, the default local = false
Zaban: The code can be a plus for some
var Bulk = new new MySqlBulkLoader (Conn) { the CharacterSet = " utf8mb4 " , the Local = to true , # add this, refer to the official documents, the end of the text there are links FIELDTERMINATOR = " , " , FieldQuotationCharacter = ' " ' , EscapeCharacter = ' " ' , a LineTerminator = " \ r \ the n- ", FileName = csvFileItemPath, NumberOfLinesToSkip = 1, TableName = cacheTableName }
Error: MySqlBulkLoader newspaper The used command is not allowed with this MySQL version; set local_infile = 1 is also futile
Why: guess mysqlconnection, this feature is turned off by default. As for why global variables enable load data or not, I did not get to the bottom, there is to know little friends can tell me the best of the [Manual Kobold]
Zaban: Modify the connection string, plus allowLoadLocalInfile
Data Source=***.***.***.*;Initial Catalog=******;user id=*****;pwd=*******;allowLoadLocalInfile=true;
Error: Wan-hand cheap, that is the problem package, the mysql.data.ef6 contracted to upgrade, found a quick run are being given
Why: mysql.data.ef6 relocated, the latest version of the package mysql.data.entityframework. If you still have problems (specifically what wrong I will not put up), put the following call this config
<entityFramework codeConfigurationType="MySql.Data.EntityFramework.MySqlEFConfiguration, MySql.Data.EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </providers> </entityFramework>
reference:
Above Mysql8 version is disabled by default load data command officer declared
https://dev.mysql.com/doc/refman/8.0/en/load-data-local.html
LoadData related command
https://dev.mysql.com/doc/refman/5.7/en/load-data.html
命令报错:ERROR 1148: The used command is not allowed with this MySQL version
Examples of official MySqlBulkLoader
https://dev.mysql.com/doc/connector-net/en/connector-net-programming-bulk-loader.html