MySQL中LOAD DATA INFILE出现“ERROR 1148 (42000): The used command is not allowed with this MySQL version”

通过命令行向mysql快速导入数据的时候,运行Load data local infile命令会报错:

ERROR 1148 (42000): The used command is not allowed with this MySQL version

查看MySQL的local_infile变量状态:

mysql> show global variables like 'local%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
1 row in set, 1 warning (0.01 sec)

通过:

mysql> set global local_infile = 'on';
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'local%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set, 1 warning (0.00 sec)

设置为开启状态。然后exit退出,利用--local-infile=1 -u root -p 语句重新登陆MySQL,然后执行导入语句就可以顺利导入数据了。

posted @ 2018-08-22 21:56  大齊  阅读(853)  评论(0编辑  收藏  举报