gpt4 book ai didi

mysql - 使用批处理脚本在Windows上安装mysql服务器

转载 作者:行者123 更新时间:2023-11-29 19:46:07 27 4
gpt4 key购买 nike

我正在使用批处理脚本在 Windows 上安装 mysql。

@echo off
echo Installing MySQL Server. Please wait...

msiexec /i "D:\MySQL\mysql-installer-community-5.6.34.0.msi" /qn /norestart

echo Configurating MySQL Server...

"%Program Files%MySQL\MySQL Server 5.6\bin\mysqlinstanceconfig.exe" -i -q ServiceName=MySQL RootPassword=mysql ServerType=DEVELOPER DatabaseType=MYISAM Port=3306 Charset=utf8

echo MySQL has been installed successfully

setx PATH "%%Program Files%\MySQL\MySQL Server 5.5\bin%;"
pause

cd /

c:

mysql --user=root --password=mysql -e "CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'user1';"
;

mysql --user=root --password=mysql -e "GRANT ALL ON mydatabase.* TO 'myuser'@'%' IDENTIFIED BY 'user1' WITH GRANT OPTION;

在上面的脚本中存在任何错误。我收到错误。“系统找不到指定的路径”

最佳答案

以下脚本似乎对我有用。我刚刚删除了 %Program Files% 之间的空格,并在 %ProgramFiles% 之后添加了一个反斜杠。

@echo off
echo Installing MySQL Server. Please wait...

msiexec /i mysql-5.5.25a-winx64.msi /passive

echo Configurating MySQL Server...

"%ProgramFiles%\MySQL\MySQL Server 5.5\bin\mysqlinstanceconfig.exe" -i -q
ServiceName=MySQL RootPassword=mysql ServerType=DEVELOPER DatabaseType=MYISAM
Port=3306 Charset=utf8

echo MySQL has been installed successfully

setx PATH "%ProgramFiles%\MySQL\MySQL Server 5.5\bin%;"
pause

附注批处理脚本和安装程序位于同一文件夹中。

关于mysql - 使用批处理脚本在Windows上安装mysql服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40966690/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com