mysql> insert into helpme set user=(select 0x616361 into outfile 'c://windows//temp//test.ini');
Database changed
mysql> select * from helpme;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
| user | id |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
| a | 1 | | 37833 |
| aca | 37834 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
2 rows in set
为什么用户是aca?并且找不到文件(c://windows//temp//test.ini)?
答案 0 :(得分:0)
SELECT … INTO …
can’t be used in a sub-query:
不应在嵌套
INTO
中使用SELECT
子句,因为这样的SELECT
必须将其结果返回到外部上下文。
这就是MySQL选择返回值而不是将其写入文件的原因。