Rootop 服务器运维与web架构

mysql load data导入数据报 The used command is not allowed with this MySQL version 错误

版本:mysql 8.0.18

mysql> use dkparel_prod;
mysql> load data local infile '/mnt/upload_sql/2024-01-10_gameAccountingHistory.csv' into table gameaccountinghistory3 fields terminated by '\t' lines terminated by '\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version

# 通过mysql命令行临时修改也没效果
mysql> set global local_infile=on;
mysql> show global variables like 'local_infile';

# 可以在进mysql命令行时加参数解决
[root@db01 ~]# mysql -uroot -pxxx --local-infile=1

# 或者在shell中加参数直接执行sql语句
[root@db01 ~]# mysql -uroot -pxxx --local-infile=1 dkparel_prod -e "load data local infile '/mnt/upload_sql/2024-01-10_gameAccountingHistory.csv' into table gameaccountinghistory3 fields terminated by '\t' lines terminated by '\n';"

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/5520.html

作者:Venus

服务器运维与性能优化

评论已关闭。