Skip to content

How to Execute Shell Commands in MySQL

  • by
Can I issue shell commands under MySQL prompt? Yes, you can. You 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

Don't forget to add these characters before shell commands:
  • a backslash
  • a exclamation mark
  • a white space

Leave a Reply

Your email address will not be published.