1.設置環境變量
不管是用戶環境變量仍是系統環境變量mysql
2.啓動服務sql
進入根目錄shell
名字根據 --install 後的 參數來決定 叫MariaDB,MySQL 均可以bootstrap
mysqld.exe --install MariaDB
Service successfully installed.less
mysqld.exe --remove MariaDB
Service successfully removed.socket
net start MariaDB
MariaDB服務正在啓動 .
MariaDB服務已經啓動成功。this
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
在服務能夠看到code
"D:\Program\MariaDB\mariadb-10.3.12-winx64\bin\mysqld.exe" "--defaults-file=D:\DB\my.ini" "MariaDB"orm
卸載
mysqld.exe安裝的服務,卸載必須用cmd(管理員權限) , powershell中 sc 命令無效
調用sc delete mariaDB
[SC] DeleteService 成功
mysqld.exe --console