运行SQL然后显示数据库列表的BAT文件

时间:2019-03-30 06:22:31

标签: mysql batch-file

我正在尝试制作一个BAT文件,以打开MYSQL并将管道数据库输出到文本文件。
请,谢谢。

::BAT file that opens up MYSQL and pipes DATABASES into a text file.
::20190330
::JimmyWilliams
@echo off
setlocal enabledelayedexpansion
cls
Echo Opens up MYSQL and shows databases
pause
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql -uJames -p****** 
SHOW DATABASES; > C:\Users\Jimmy\Desktop\test.txt
pause

1 个答案:

答案 0 :(得分:0)

刚刚找到答案:

::20190330
::JimmyWilliams
@echo off
setlocal enabledelayedexpansion
cls
Echo Opens up MYSQL and shows databases
pause
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql -uJames -p****** -e "SHOW DATABASES;" > C:\Users\Jimmy\Desktop\test.txt
pause

如何删除“密码警告提示”?