% mysql cookbook > outputfile However, if you try to run mysql interactively with the output redirected, you won’t be able to see what you’re typing, so generally in this case you’ll also take query input from a file (or another program): % mysql cookbook < inputfile > outputfile You can also send query output to another program. For example, if you want to mail query output to someone, you might do so like this: % mysql cookbook < inputfile | mail paul Note that because mysql runs non-interactively in that context, it produces tab-delimited output, which the mail recipient may find more difficult to read than tabular output. Recipe 1.22 shows how to fix this problem. 1.22 Selecting Tabular or Tab-Delimited Query Output Format 1.22.1 Problem mysql produces tabular output when you want tab-delimited output, or vice versa. 1.22.2 Solution Select the desired format explicitly with the appropriate command-line option. 1.22.3 Discussion When you use mysql non-interactively (such as to read queries from a file or to send results into a pipe), it writes output in tab-delimited format by default. Sometimes it's desirable to produce tabular output instead. For example, if you want to print or mail query results, tab- delimited output doesn't look very nice. Use the -t (or --table) option to produce tabular output that is more readable: % mysql -t cookbook < inputfile | lpr % mysql -t cookbook < inputfile | mail paul The inverse operation is to produce batch (tab-delimited) output in interactive mode. To do this, use -B or --batch. 1.23 Specifying Arbitrary Output Column Delimiters 1.23.1 Problem You want mysql to produce query output using a delimiter other than tab. 1.23.2 Solution
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services