MySQL: How to export the output for a non SQL query sentence?
4
votes
2
answers
158
views
In MySQL 8 server community to export a SQL query's output is possible execute in the
MySQL Shell
the following command (as most basic):
SELECT * FROM cientifico INTO OUTFILE '/var/lib/mysql-files/cientifico-data.txt';
And it works as expected
But for a non SQL query as follows:
SHOW PROCESSLIST INTO OUTFILE '/var/lib/mysql-files/processlist.txt';
Throws the following error
> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE '/var/lib/mysql-files/processlist.txt'' at line 1
Same as:
SHOW DATABASES INTO OUTFILE '/var/lib/mysql-files/databases.txt';
Giving
> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE '/var/lib/mysql-files/databases.txt'' at line 1
Therefore if is possible
**Question**
* How to export the output for a non SQL query sentence?
I am assuming that the INTO OUTFILE
syntax is only for SQL sentences, but for non SQL sentences?
Asked by Manuel Jordan
(229 rep)
Apr 18, 2025, 03:31 AM
Last activity: Apr 22, 2025, 08:27 PM
Last activity: Apr 22, 2025, 08:27 PM