mariaDB 安装/卸载+启动/关闭 服务

1.设置环境变量

无论是用户环境变量还是系统环境变量

2.安装服务

进入根目录

名字根据 --install 后的 参数来决定 叫MariaDB,MySQL 都可以

mysqld.exe --install MariaDB
Service successfully installed.

安装通过ini配置文件(不配置环境变量, 一定要通过这种方式 来安装服务)
mysqld.exe --install MariaDB --defaults-file=D:\DB\my.ini

最后可以看到服务的配置[属性]中, [可执行文件路径], 有以下信息
D:\Program\MariaDB\mariadb-10.3.12-winx64\bin\mysqld.exe --defaults-file=D:\DB\my.ini MariaDB

3.卸载服务

mysqld.exe --remove MariaDB
Service successfully removed.

4.启动服务

net start MariaDB
MariaDB服务正在启动 .
MariaDB服务已经启动成功。

5.停止服务

net stop MariaDB
MariaDB服务正在停止.
MariaDB服务已成功停止。


.\mysql_install_db.exe
-?, --help Display this help message and exit.
-d, --datadir=name Data directory of the new database
-S, --service=name Name of the Windows service
-p, --password=name Root password
-P, --port=# mysql port
-W, --socket=name named pipe name (if missing, it will be set the same as
service)
-D, --default-user Create default user
-R, --allow-remote-root-access
Allows remote access from network for user root
-N, --skip-networking
Do not use TCP connections, use pipe instead
-i, --innodb-page-size=#
Page size for innodb
-s, --silent Print less information
-o, --verbose-bootstrap
Include mysqld bootstrap output
FATAL ERROR: parameter --datadir=# is mandatory
PS D:\Program\MariaDB\mariadb-10.3.12-winx64\bin> .\mysql_install_db.exe -d D:\DB -S MariaDB
Running bootstrap
2019-02-13 16:46:10 0 [Note] D:\Program\MariaDB\mariadb-10.3.12-winx64\bin\mysqld.exe (mysqld 10.3.12-MariaDB) starting as process 9212 ...
Removing default user
Creating my.ini file
Registering service 'MariaDB'
Creation of the database was successful

在服务可以看到

"D:\Program\MariaDB\mariadb-10.3.12-winx64\bin\mysqld.exe" "--defaults-file=D:\DB\my.ini" "MariaDB"


卸载

mysqld.exe安装的服务,卸载必须用cmd(管理员权限) , powershell中 sc 命令无效

调用sc delete mariaDB
[SC] DeleteService 成功


  • 命令行方式启动 mysqld.exe --console
posted @   scott_h  阅读(8172)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2017-02-13 网络工具 NetCat
点击右上角即可分享
微信分享提示