MySql静默安装/ qn无法正常工作

时间:2014-06-16 13:07:47

标签: mysql batch-file windows-7 silent-installer

我使用下面的代码使用批处理文件在Windows上静默安装mysql ..

好像是在忽略/ qn

我也尝试过/ quiet,但这也无效。

它只是读取行并将光标移动到下一行。

echo off
cls

echo Starting MySQL mysql-essential-5.0.88-win32 install
msiexec /i "mysql-essential-5.0.88-win32.msi" /qn INSTALLDIR="C:\Program Files\MySQL" /L* "C:\Program Files\MySQL\mysql-log.txt"
echo MySQL mysql-essential-5.0.88-win32 installed successfully

echo Creating MySQL Windows service
"C:\Program Files\MySQL\bin\mysqlinstanceconfig.exe" -i -q ServiceName="MySQL service" RootPassword="newRootPassword" ServerType=SERVER DatabaseType=MYISAM Port=3306 

RootCurrentPassword=mysql
echo MySQL Instance Configured. Service started.

pause

我试过直接运行命令,但它完全忽略了

注意:如果我直接运行它,安装程序工作正常,问题是仅使用静默安装

请建议。

感谢。

2 个答案:

答案 0 :(得分:0)

/ni
/q
/qn
/quiet
/s
/silent

尝试破折号而不是正斜杠(-S代替/ S),并检查大写和小写。 希望有所帮助。

答案 1 :(得分:0)

@Echo off

FOR /F "tokens=5" %%a in ('netstat -aon ^| find "3306" ^| find "LISTENING"') do taskkill /f /pid %%a
cls
TIMEOUT 1

if "%ProgramFiles(x86)%" == "" (
    set "MySQLServerPath=%ProgramFiles%\MySQL\MySQL Server 5.0\bin"
 ) else (
     set "MySQLServerPath=%ProgramFiles(x86)%\MySQL\MySQL Server 5.0\bin"
 )

REM echo Configurating MySQL Server ...
 "%MySQLServerPath%\MySQLInstanceConfig.exe" -i -q ServerType=DEVELOPER ConnectionUsage=DSS Port=3306 StrictMode=yes Charset=utf8 DatabaseType=MIXED ServiceName=root RootPassword=root
REM echo MySQL has been configured successfully.