MYSQL导入数据报错

开始导入MYSQL导入数据出现The MySQL server is running with the --secure-file-priv option

查了一下说是Mysql的导入导出路径目录问题,改了my.ini文件中的secure-file-priv值为

secure-file-priv=""

现在执行SQL导入报错如下:

mysql> load data infile 'E:\sql\film_test.txt' into table film_test2;

ERROR 29 (HY000): File 'E:\sqlfilm_test.txt' not found (OS errno 2 - No such file or directory)

文件路径是对的呢,怎么会报错找不到

阅读 3.4k
2 个回答

你的MySQL是什么版本,自己编译的吗?
对这个参数有点印象,MySQL官方说明中对其有介绍,默认设置为NULL,据说会禁止数据导入导出;也有设置成DINSTALL_SECURE_FILE_PRIVDIR=/usr/local/mysql/mysql-files这样的非NULL,包括空值,不过空值会有问题:

A non-NULL value is considered insecure if it is empty, or the value is the data directory or a subdirectory of it, or a directory that is accessible by all users. If secure_file_priv is set to a nonexistent path, the server writes an error message to the error log and exits.

大体这意思是说,最好指向一个真实存在的目录,且系统用户均可访问。我记得说明手册上写的范例是在/usr/local/mysql这个目录下新建。

有个软件叫 Navicat

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题