When I am running mysql in the terminal
I can do something like \! python ~/run.py开发者_C百科
to run the the file.
However when I copy this to php and do mysql_query it doesnt work.
You cannot run any of the \ prefix mysql commands in PHP's mysql_query
.
Only valid SQL commands can be used.
You can't do that.
The \!
commands in the MySQL Console are provided by the Console itself, not by the MySQL server proper. In other words, these commands are not sent to the MySQL server, but they are passed to the shell from which the console was launched (e.g. bash). This is a convenience shortcut, but won't work with normal SQL commands.
精彩评论