开发者

How to get output of shell in MySQL?

In linux I can use ! to start a shell command:

mysql >\! ping localhost

Is there a way to get the output of shell in MySQL?开发者_如何学C


While in the mysql prompt, no. You can however pipe the results of a command into mysql with something similar to:

mysql -u user -ppassword < `ping localhost`

The only issue with this is that whatever your shell command returns needs to be the sum of the commands/data you want to issue to mysql. This is most commonly used to execute a script or something similar.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜