Home  >  Article  >  Database  >  Teach you to print data directly from MySQL to a file

Teach you to print data directly from MySQL to a file

藏色散人
藏色散人forward
2020-04-01 08:55:162380browse

Teach you to print data directly from MySQL to a file

Create alias

alias db='mysql -hlocalhost -uroot -p123456'

Create the execution file of the mysql statement: mysql.txt

select * from test_db.test_table

Enter

$ db < /path/to/mysql.txt | cat > store.log
## in the Linux command line #The final data in store.log is the result of select * from db.table.

So useful!

Recommended: "

mysql video tutorial"

The above is the detailed content of Teach you to print data directly from MySQL to a file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete