MySQL与宿主Linux之间交互式执行命令

  • 在MySQL里面执行Linux的命令并返回结果

system commands

root@localhost 11:36:23> system cal
     March 2017     
Su Mo Tu We Th Fr Sa
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

root@localhost 11:36:29>

 

  • 在Linux的bash环境下执行MySQL里面的命令并返回结果

mysql -u root -p123456 -e 'show grants for 'standby'@'localhost';'

[root@standby mysql]# mysql -u root -p123456 -e 'show grants for 'standby'@'localhost';'
+----------------------------------------------------------------------------------------------------------------+
| Grants for standby@localhost                                                                                   |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'standby'@'localhost' IDENTIFIED BY PASSWORD '*68400CF212112D85B99EB397ADCB27748218BFAE' |
| GRANT ALL PRIVILEGES ON `facebook`.* TO 'standby'@'localhost'                                                     |
+----------------------------------------------------------------------------------------------------------------+
[root@standby mysql]#

  

posted @ 2017-07-13 00:19  lixin[at]hitwh  阅读(623)  评论(0编辑  收藏  举报