1, if the MySQL server is the machine you want to export files, then you can directly use
Select ... into outfile
Statement.
Cases:
SELECT * from rank to outfile "/home/a.txt"
2, if the MySQL server is a separate machine, we are operating on a client, we want to import data results on the client machine. You can use the MYSQL-E statement.
Cases:
mysql-uroot-proot-p3310-h10.1.2.3 dbname-e "SELECT * from rank" >/home/a.txt
3. Use the MySQL tee (\ t) command, which is to input all MySQL output to the specified file.
Cases:
Mysql>tee/home/a.txtmysql>select * from Rank;mysql>exit
Mysql-uroot-p dbname-e "select * from User_role_new; Show profile CPU, block IO for query "> ~/aa.txt
Backup Command
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How does MySQL output output on the screen to a file?