views:

413

answers:

3

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?

A: 

I don't believe there is a simple way to do it. I cannot guarantee there isn't some hack to do it though.

The only scripts mysql will let you run from within sql is another .sql script.

Kazar
+4  A: 

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
Ayman Hourieh
Of course this only works in the MySQL command-line client. Not from the database server itself.
Peter Stuifzand
A: 

It's actually possible to execute shell commands on the server that mysqld is running though a client connection (rather than executing commands on the client machine locally) by using MySQL Proxy (scroll down to the "Shell commands from MySQL client" section ).

ʞɔıu