MariaDB won’t start as a service on Windows Server 2016 – works fine from cmd prompt

mariadbwindows-server-2016windows-service

Fresh server running Windows Server 2016 Standard along with a fresh copy of MariaDB 10.3.14. MariaDB starts and runs perfectly when started from the command line using:

mysqld.exe "--defaults-file=D:\ZZ-MariaDB_Data\my.ini" --console

When it's running I can connect to it locally and remotely just fine. Defined as a service the path to executable value is:

D:\MariaDB\bin\mysqld --defaults-file=D:\ZZ-MariaDB_Data\my.ini

When I try to start the service the starting progress bar pauses about half way through the starting and then fails with the message:

Windows could not start the MariaDB service on Local Computer.

Error 1053: The service did not respond to the start or control
request in a timely fashion.

The box has nothing else on it but Apache right now so virtually 100% of the processor is available. For the life of my I can't figure out why it won't start as a service when it runs just fine from a command prompt.

The log from the console when started from a command prompt shows no errors or issue:

D:\MariaDB\bin>mysqld.exe "--defaults-file=D:\ZZ-MariaDB_Data\my.ini" --console
2019-06-04 14:16:08 0 [Note] mysqld.exe (mysqld 10.3.14-MariaDB) starting as process 5316 ...
2019-06-04 14:16:08 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-06-04 14:16:08 0 [Note] InnoDB: Uses event mutexes
2019-06-04 14:16:08 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-06-04 14:16:08 0 [Note] InnoDB: Number of pools: 1
2019-06-04 14:16:08 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-06-04 14:16:08 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-06-04 14:16:08 0 [Note] InnoDB: Completed initialization of buffer pool
2019-06-04 14:16:08 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1630869
2019-06-04 14:16:08 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-06-04 14:16:08 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-06-04 14:16:08 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-06-04 14:16:08 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-06-04 14:16:08 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2019-06-04 14:16:08 0 [Note] InnoDB: Waiting for purge to start
2019-06-04 14:16:08 0 [Note] InnoDB: 10.3.14 started; log sequence number 1630878; transaction id 21
2019-06-04 14:16:08 0 [Note] InnoDB: Loading buffer pool(s) from D:\ZZ-MariaDB_Data\ib_buffer_pool
2019-06-04 14:16:08 0 [Note] InnoDB: Buffer pool(s) load completed at 190604 14:16:08
2019-06-04 14:16:08 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-06-04 14:16:08 0 [Note] Server socket created on IP: '::'.
2019-06-04 14:16:08 0 [Note] Reading of all Master_info entries succeded
2019-06-04 14:16:08 0 [Note] Added new Master_info '' to hash table
2019-06-04 14:16:08 0 [Note] mysqld.exe: ready for connections.
Version: '10.3.14-MariaDB'  socket: ''  port: 3306  mariadb.org binary distribution

Best Answer

Though I'm not exactly sure what fixed the issue I removed the MariaDB service and the data directory completely. I then used mysql_install_db to create the data directory and the service all in one shot. That allowed the service to start correctly.

The only thing that I can figure is that somewhere along the lines of trying things yesterday I messed up permissions as suggested by Peter Hahndorf in the comments to my original question. Since this was a fresh installation and I didn't need to preserve anything it was easiest to just start from scratch and it worked.

The full mysql_install_db command I used for reference was:

mysql_install_db --datadir=d:\ZZ-MariaDB_Data --service=MariaDB --password=myrootpasswordhere