参考连接: https://mariadb.com/kb/en/mysql_install_dbexe/
下载压缩包,解压,然后将bin文件夹加入Path。
然后打开CMD窗口执行安装命令:(管理员权限)
mysql_install_db.exe --datadir=C:db --service=MyDB --password=secret
例如:
# 安装mariadb,注册为mysql服务,初始密码123456
C:Windowssystem32>mysql_install_db.exe --datadir=D:mariadbdata --service=mysql --password=123456
Running bootstrap
2020-07-07 18:12:51 0 [Note] D:mariadbinmysqld.exe (mysqld 10.4.8-MariaDB) starting as process 4144 ...
Removing default user
Setting root password
Creating my.ini file
Registering service "mysql"
Creation of the database was successful
管理服务:
# 启动服务,开机自启动
sc start mysql
# 停止服务
sc stop mysql
# 删除服务
sc delete mysql
# 删除数据
rmdir /s /q
修改配置文件:
[mysqld]
character-set-server = utf8mb4
datadir=D:/mariadb/data
[client]
default-character-set = utf8mb4
plugin-dir=D:/mariadb/lib/plugin