SELECT * INTO OUTFILE LOCAL in MySQL
MySQL's SELECT * INTO OUTFILE statement allows users to export data from a table to a text file on the server machine. However, if the desired location of the file is on a client host different from the server, the statement is hindered by security concerns.
This limitation does not apply to the LOAD DATA INFILE statement. By adding LOCAL before INFILE, users can load data from a file located on the client host.
Unfortunately, there is no equivalent SELECT INTO OUTFILE LOCAL statement in MySQL. The manual explains that the INTO OUTFILE statement is primarily intended for creating text file dumps on the server machine. For client host destinations, it recommends using the mysql command with the -e option.
mysql -h my.db.com -u usrname --password=pass db_name -e 'SELECT foo FROM bar' > /tmp/myfile.txt
MariaDB's Handling of this Problem
Whether MariaDB can handle this problem is unknown as it was not mentioned in the question or answer provided.
The above is the detailed content of Can you export data to a client host file using `SELECT * INTO OUTFILE` in MySQL?. For more information, please follow other related articles on the PHP Chinese website!