Skip to content
Home » MySQL » How MySQL Run Shell Command

How MySQL Run Shell Command

Can we execute system commands under MySQL prompt? Yes, we can.

We can do it by adding \!  (a backslash, a exclamation mark and a white space) before the shell command. For example, if you want to know present working directory, you can do it like this:

mysql> \! pwd
/root

Don't forget to add these characters before shell commands:

  • A backslash (\)
  • A exclamation mark (!)
  • A white space ( )

MySQL Shell 8.0 / Using MySQL Shell Commands / MySQL Shell Commands

Leave a Reply

Your email address will not be published. Required fields are marked *