开发者

Executing unix commands from mysql

开发者 https://www.devze.com 2023-01-15 10:37 出处:网络
When I am running mysql in the terminal I can do something like \\! python ~/run.py开发者_C百科 to run the the file.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号