bat批处理执行MySQL

批处理文件执行MySQL并导出查询结果~

 

@echo off
echo 批处理文件执行MySQL

title 批处理文件执行MySQL
set path_home_mysql=D:\MySQL5\
set path_bin_mysql=%path_home_mysql%bin\
set ip=127.0.0.1
set database_mysql=database_name
set user_mysql=user_name
set password_mysql=pass_word
set port_mysql=port

set yy=%date:~0,4%
set mo=%date:~5,2%
set dd=%date:~8,2%
set hh=%time:~0,2%
set mm=%time:~3,2%
set ss=%time:~6,2%
set ms=%time:~9,2%

echo 当前时间:%date% %time%

 


%path_bin_mysql%mysql -u%user_mysql% -p%password_mysql% nnm5 -h%ip% -P%port_mysql% -e" sql into outfile 'd://%yy%_%mo%_%dd%@%hh%.%mm%.%ss%.%ms%.txt'";


pause

你可能感兴趣的:(mysql,bat)