Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get a stdout of basic MySQL commands in BASH?

Tags:

bash

mysql

Can I get a stdout of basic MySQL commands in BASH? show, describe for starters. I'm troubleshooting a problem with several databases and I want to compare them with increasing specificity. The dump is just too much information.

like image 750
xtian Avatar asked Mar 25 '12 02:03

xtian


People also ask

How do I get out of MySQL prompt?

To exit from mysql type quit at the mysql> command-prompt.

What is shell script in MySQL?

The Workbench Scripting Shell provides a means for entering and executing Python scripts. Through the use of the scripting shell, MySQL Workbench can support new behavior and data sources using code written in Python. The shell can also be used to explore the current Workbench Generic RunTime (GRT) facilities.


1 Answers

echo "command" | mysql -u username -ppassword -h host database_name

not only basic command but full SQL can be run this way

like image 62
dhchen Avatar answered Oct 12 '22 22:10

dhchen