1
我想使用CONNECT引擎将外部文件读入MariaDB。然而,试图从文件中读取的时候,我得到一个错误信息:MariaDB CONNECT引擎读取外部文件
MariaDB [test]> create table test (name varchar(100), team varchar(100)) engine=CONNECT table_type=CSV file_name='/tmp/data.csv' header=1 sep_char=',' quoted=0;
Query OK, 0 rows affected (0.24 sec)
MariaDB [test]> select * from test;
ERROR 1296 (HY000): Got error 174 'Open() error 13 on /tmp/data.csv: Permission denied' from CONNECT
检查文件系统权限给了我:
[email protected] ~ $ ls -l /tmp/data.csv
-rw-rw-rw- 1 divingt divingt 1658 Dec 31 13:59 /tmp/data.csv
所以每个人都应该能够读取和文件写入。
同样在MYSQL的权限允许的一切:
MariaDB [test]> SHOW GRANTS;
+------------------------------------------------------------------------------------------------+
| Grants for [email protected] |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
我运行一个Linux Mint的系统。
非常感谢您的帮助。
考虑使用'LOAD DATA'而不是Connect? –
是的,这是有效的。然而,关键是使用连接引擎,因为我也想用它来读取XML数据。 – divingTobi