Windows中bat脚本一键安装mariadb

欢迎观看BigBig猿的空间

文件结构

解压缩后Mariadb_Install_win文件夹下的文件结构;
在这里插入图片描述
在这里插入图片描述

脚本内容

在这里插入图片描述

  1. install.bat;
@echo off                    
echo "This operation will unzip all zip and tar files"   
echo %~dp0
cd /D %~dp0
set cpath=%cd%
set name=%cpath%\uzip\ZipTool.exe
set opath=D:\package\DB\
REG ADD "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v %cpath%\uzip\ZipTool.exe /t REG_SZ /d RUNASADMIN /f
REG ADD "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\autorun.bat" /t REG_SZ /d RUNASADMIN /f
echo installer will create directories....
md %opath%mariadb
echo installer will unzip mariadb...
start /wait /min %name% -zip %cpath%\mariadb\mariadb-10.3.13-winx64.zip  %opath%mariadb
echo installer will copy extract files...
copy  %cpath%\mariadb\my.ini  %opath%mariadb\mariadb-10.3.13-winx64\data
echo installer will config system...
echo config mariadb
cd /D %~dp0
set cpath=%cd%
call %cpath%\mariadb\mariadb.bat
echo config autorun
set auto="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
cd /D %~dp0
set cpath=%cd%
copy  %cpath%\autorun.bat          %auto%
echo install success,please enter any key to config system!
pause
call %cpath%\config.bat
  1. mariadb.bat;
@echo off
echo  "This operation will config mariadb"
echo %~dp0
cd /D %~dp0
set cpath=%cd%
echo %cpath%
set opath=D:\package\DB\mariadb\mariadb-10.3.13-winx64
taskkill /IM mysqld.exe /F
%opath%\bin\mysqld.exe --remove mariadb
start /wait /min %opath%\bin\mysqld.exe --install mariadb --defaults-file=%opath%\data\my.ini
net start mariadb
%opath%\bin\mysqladmin.exe -u root --password=bethlabs create icapweb
%opath%\bin\mysql.exe -uroot  -pbethlabs icapweb < %cpath%\createdb\icapweb.sql
setx mariadbPath "D:\package\DB\mariadb\mariadb-10.3.13-winx64\bin" /M
setx Path "%Path%;D:\package\DB\mariadb\mariadb-10.3.13-winx64\bin"

使用说明

在这里插入图片描述

下载文件

看到这感觉被套路的小伙伴啊,别担心,不妨再往下看































回馈即分享,支持即感谢

这个博主有点皮啊!感谢支持,需要的小伙伴,关注一下,私信我发送mariadb,即可收到全部资源。不需要它的也没关系,后续还会有更多内容(java、架构、分布式、服务容器化、自动化部署、数据库优化、nosql、hadoop生态、大数据方案、各种脚本)与大家分享,都在自己笔记中了,容我慢慢整理一下哈。

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AK@

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值