SUMMARY
Usually people run MySQL query from the MySQL prompt, but it's a common practice to run it from command line and write the output into a file. This article provides the steps for doing it.
ENVIRONMENT
CA Performance Management (all versions)
All supported platforms
INSTRUCTIONS
Here is an example of a sql statement (between the double quotes) run from the command line; netqosportal.dst_device is the database name and table name.
mysql -e "select SourceID,ItemID,ItemName,Model from netqosportal.dst_device;" > /tmp/output.txt
Below is what the file content looks like
cat /tmp/output.txt
SourceID ItemID ItemName Model
3 117 Sim23571:CGYLAB_C881.allstream.com
3 116 Sim24077:brlb-cmts-2 BSR64000
3 118 Sim24593:NetScaler Citrix NetScaler
3 115 DataAggregator:10.130.153.96 NULL
3 114 IMDC1RH65 NULL
5 305 marjo46-rtr-01.ca.com NULL
6 357 cis2524-blue-96.26.ca.com NULL
6 355 cis2514-96.24 NULL
6 356 cis3640-96.25.153 NULL
6 350 cis7505-96.10.10.ca.com NULL
6 353 cis3810-96.13.ca.com NULL
6 361 rs3000-green-96.30 NULL
6 360 rs3000-green-96.29-1411911752 NULL
6 349 cisco2621-96.7.ca.com NULL
6 365 cis3750-183.6.ca.com NULL
6 362 cis2524-cyan-96.31.ca.com NULL
6 352 cis3810-96.12.ca.com NULL
6 364 rs3000-PurpleCE1-96.39 NULL
6 351 cis7505-96.11.ca.com NULL
6 354 cis3640-96.22.ca.com NULL
6 366 rs3000-246.19 NULL
6 363 cis2811-96.32 NULL
6 348 cis7204-96.6.ca.com NULL
|