Creating a new database instance on Windows (mysql_install_db.exe)
mysql_install_db.exe
utility is provided on Windows starting with MariaDB 5.2.6
Functionality
Its functionality is comparable with shell script mysql_install_db
used on Unix, however it has been extended to both Windows specific functionality (creating Windows service), and to generally useful functionality - it can set 'root' user password during database creation, it creates configuration file my.ini in the data directory and adds most important parameters into it (e.g port). mysqld_install_db.exe
is used by MariaDB installer, if "Database instance" feature is selected.
It obsoletes similar utilities and scripts that were used in the past , like mysqld.exe --install
, mysql_install_db.pl
mysql_secure_installation.pl
Parameter | Description |
---|---|
-?, --help | Display help message and exit. |
-d, --datadir=name | Data directory of the new database |
-S, --service=name | Name of the Windows service |
-p, --password=name | Password of the root user |
-P, --port=# | mysqld port |
-W, --socket=name | named pipe name |
-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 |
Note : to create Windows service, user should run as full administrator (which means elevated command prompt on systems with UAC)
Example usage
mysqld_install_db.exe --datadir=C:\db --service=MyDB --password=secret
will create database in the directory C:\db, register auto-start Windows service MyDB, and set root password to 'secret'.
To start service from the command line, execute
sc start MyDB
Removing databases instances
If you run database instance as service, to remove it completely from the command line, use
sc stop <servicename> sc delete <servicename> del /s /q <path-to-datadir>