开发者

How to get output of shell in MySQL?

开发者 https://www.devze.com 2022-12-18 00:34 出处:网络
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?开发者_如何学CWhile in the mysql prompt, no. You can however pipe the

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

精彩评论

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