In oracle database, command "host" can be used to run bash command from database command window. Is there a equivalent command as "host" in mySql?
The \edit ( \e ) command opens a command in the default system editor for editing, then presents the edited command in MySQL Shell for execution. The command can also be invoked using the key combination Ctrl-X Ctrl-E. For details, see Section 5.4, “Editing Code”.
The MySQL Shell is a big advancement over the old command line client. First, it has three dialects — SQL, Python, and JavaScript. If you have libraries or code in either Python or JavaScript to use on your data then you can use them.
You can use the system
command.
system command, \! command
Executes the given command using your default command interpreter.
The system command works only in Unix.
Example:
system ls -l
As an additional tweak, on most "'nix" systems you can actually do something like this:
mysql> system bash
And have the entire terminal at your disposal. This is particularly effective if you're doing code work in the terminal that interfaces with MySQL; from the shell, typing "exit" will take you back into the MySQL monitor/client, so you can go back and forth quite easily.
Obviously, other shells ("mysql> system tcsh") would work as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With