Ok, As you know I am trying to explore more of the mysql command line and exploring its features. I have already written about how to change default mysql prompt using the command "prompt" in one of my previous articles.
Continuing this series. I am focusing today on the "system" command or "/!".
Well, I always have some of the sql source files and I execute it from the mysql command line. But I just keep forgetting their names. And most of the times I either close the mysql session and do 'ls' at the command line or move the mysql session in background and do a 'ls'.
Mysql cli has this very useful command called "system" using which you can execute shell commands from mysql client itself.
just type
You can run almost all system commands using either of system or '\!'
Some examples:
Liked it ! Start playing with mysql client system command.
Continuing this series. I am focusing today on the "system" command or "/!".
Well, I always have some of the sql source files and I execute it from the mysql command line. But I just keep forgetting their names. And most of the times I either close the mysql session and do 'ls' at the command line or move the mysql session in background and do a 'ls'.
Mysql cli has this very useful command called "system" using which you can execute shell commands from mysql client itself.
just type
system ls -lor
\! ls -lSome of us, who are familiar with Vim, will like this "\!" version a lot, because we are already using ! to run system commands there.
You can run almost all system commands using either of system or '\!'
Some examples:
mysql:root@test [14:26:19 pm]$ \! pwdYou see the last one is quiet interesting. You can actually open a shell using this command perform some tasks. Just exit from the shell and you are back in the mysql world.
/home/owner
mysql:root@test [14:29:33 pm]$ \! date
Thu Mar 26 14:29:46 SGT 2009
mysql:root@test [14:29:46 pm]$ \! bash
owner@rocky-desktop:~$ exit
mysql:root@test [14:30:12 pm]$
Liked it ! Start playing with mysql client system command.
No comments:
Post a Comment