【批处理】【数据库-MySql】MySQL监控所有电脑哪台电脑执行相关指令

echo off
set file=c:\\sql.txt

set sTime=%date:~0,-3% %time:~0,-3%
:again
mysql -h172.16.75.230 -urdis -prdis qyrmyymz20200526  --default-character-set=gbk -e "SELECT * FROM information_schema.`PROCESSLIST` WHERE INFO like '%%finish_time%%' and info not like '%%PROCESSLIST%%'" >> %file%

set cTime=%date:~0,-3% %time:~0,-3%

if "%cTime%" NEQ "%sTime%" (
set sTime=%cTime%
cls
echo %sTime%
for /f "tokens=*" %%i in (%file%) do (echo %%i)
)

goto again
:end
pause

 

你可能感兴趣的:(语言-批处理,数据库-MySql)