07-27-2023, 12:24 PM
If you have PHP set up on the server, you can use [mysql2csv][1] to export an (actually valid) CSV file for an arbitrary MySQL query. See [my answer at MySQL - SELECT * INTO OUTFILE LOCAL ?][2] for a little more context/info.
I tried to maintain the option names from `mysql` so it should be sufficient to provide the `--file` and `--query` options:
./mysql2csv --file="/tmp/result.csv" --query='SELECT 1 as foo, 2 as bar;' --user="username" --password="password"
__"Install" `mysql2csv` via__
wget
(Download content of the gist, check checksum and make it executable.)
[1]:
[2]:
I tried to maintain the option names from `mysql` so it should be sufficient to provide the `--file` and `--query` options:
./mysql2csv --file="/tmp/result.csv" --query='SELECT 1 as foo, 2 as bar;' --user="username" --password="password"
__"Install" `mysql2csv` via__
wget
[To see links please register here]
-O mysql2csv -q && (sha256sum mysql2csv | cmp <(echo "b109535b29733bd596ecc8608e008732e617e97906f119c66dd7cf6ab2865a65 mysql2csv") || (echo "ERROR comparing hash, Found:" ;sha256sum mysql2csv) ) && chmod +x mysql2csv(Download content of the gist, check checksum and make it executable.)
[1]:
[2]:
[To see links please register here]