How to create a service to start my mariadb?

I installed mysql and mariadb in the same pc(win10).Port 3306 binded with mysql, 3307 with mariadb.

net start mysql #start mysql server.

Start mariadb server.

F:/mariadb-10.3\bin\mysqld --defaults-file=F:/mariadb-10.3\mysql\my.ini --user=root 

Start it in background.

start /B F:/mariadb-10.3\bin\mysqld --defaults-file=F:/mariadb-10.3\mysql\my.ini --user=root 

Now i want to create a service such as net start mysql

net start mariadb 

How to make it in windows10?

3 Answers

Use the sc command from a command prompt to add MariaDB to services.

sc create MariaDB binpath= "F:/mariadb-10.3/bin/mysqld --defaults-file=F:/mariadb-10.3/mysql/my.ini" DisplayName= "MariaDB" start= "auto"

You probably don't need the --user=root in the command when running it as a service. It's usually not needed.

  1. Run regedit. Export HKLM\SYSTEM\CurrentControlSet\Services\MySQL hive into .REG file.
  2. Edit this .REG file:
    • Replace all occurences of mysql with mariadb;
    • Edit ImagePath, set it to correct value (shown in your question as "Start mariadb server.").
  3. Import the result of your edition back into registry.
  4. Reboot (not nesessary but safe).

please look it very easy, just open your CMD as Administrator and type :

mysql_install_db.exe --datadir=F:/mariadb-10.3/bin/mysqld --service=MariaDB --password=secret

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like