I want to call an OS level commands from mysql prompt within Windows command line tool.

In Unix* there is a system command available to execute OS commands within MySQL prompt.

Any way of dong the same in windows or even in workbench as well?

The objective is to invoke a OS command within a mysql prompt.

  • The posted answer (dba.stackexchange.com/a/86271/877) is the only plausible answer. Otherwise, the only workaround is ot get the source code for the mysql client and mysql workbench and inject system code into it. Dec 16, 2014 at 16:40

1 Answer 1


You cannot run OS commands in a MySQL CLI nor in MySQL Workbench. Why would you do that (except for trying to hack a machine via an SQL connection)? If you need to run an OS command, open a normal shell window (that still stands).

Update: The system command only works on Unix like OSes (http://dev.mysql.com/doc/refman/5.6/en/mysql-commands.html), e.g. Linux + Mac.

MySQL Workbench doesn't support most of these CLI commands however (use and delimiter are 2 that are supported).

  • what could i do if i need to call a OS command within procedure execution.. Dec 16, 2014 at 8:51
  • You simply can't. It's not allowed, certainly for security reasons. Dec 16, 2014 at 11:32
  • if so then why it is allowed in UNIX* OS?.. Dec 16, 2014 at 11:33
  • 1
    I think with "that stands still" you actually mean "that still stands". "That stands still" means "it's not moving"...
    – user1822
    Dec 16, 2014 at 15:03
  • any workaround to achieve the goal @a_horse_with_no_name ? Dec 16, 2014 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.