как сохранить результат запроса к mysql в файл?

mysql> SELECT `blabla` FROM `tbl` ORDER BY `bla` DESC INTO OUTFILE '/home/user/orders.txt';

result

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

запрос выполняется черз cmd bash cli ос ubuntu


Ответы (1 шт):

Автор решения: Oopss
mysql> select * from My_TabelName into outfile '/home/user/ddbb.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

mysql> SHOW VARIABLES LIKE 'secure_file_priv';
+------------------+-----------------------+
| Variable_name    | Value                 |
+------------------+-----------------------+
| secure_file_priv | /var/lib/mysql-files/ |
+------------------+-----------------------+
1 row in set (0.04 sec)

mysql> select * from My_TabelName into outfile '/var/lib/mysql-files/ddbb.txt';
Query OK, 1030 rows affected (0.03 sec)
→ Ссылка