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 @ 2019-02-13 16:34  scott_h  阅读(7906)  评论(0编辑  收藏  举报