utf8mb4 characters not surviving “LOAD DATA INFILE”
我有一个csv文件,其中包含一些位于Unicode BMP之外的字符,例如字符
这是我的SQL查询。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | MariaDB [tweets]> set names 'utf8mb4'; Query OK, 0 rows affected (0.01 sec) MariaDB [tweets]> create table test (a text) collate utf8mb4_general_ci; Query OK, 0 rows affected (0.06 sec) MariaDB [tweets]> insert into test (a) values ('??'); Query OK, 1 row affected (0.03 sec) MariaDB [tweets]> select * from test; +------+ | a | +------+ | ?? | +------+ 1 row in set (0.00 sec) |
无警告。一切都正确。现在,我想加载该csv文件。为了进行测试,该文件只有一行。
1 2 3 4 5 | MariaDB [tweets]> load data local infile 't.csv' into table wzyboy character set utf8mb4 fields terminated by ',' enclosed by '"' lines terminated by '\ \ ' (tweet_id,in_reply_to_status_id,in_reply_to_user_id,retweeted_status_id,retweeted_status_user_id,timestamp,source,text,expanded_urls); Query OK, 1 row affected, 7 warnings (0.01 sec) Records: 1 Deleted: 0 Skipped: 0 Warnings: 7 |
警告消息是:
我所有的工作环境(OS,Termianl等)都使用UTF-8。我在所有可以想到的地方都指定了
问题已解决。
这是一个错误。在实验过程中,我只是