[MDEV-23098] mariadb-upgrade-service.exe gives FATAL ERROR on Windows Created: 2020-07-05  Updated: 2020-12-08  Resolved: 2020-07-06

Status: Closed
Project: MariaDB Server
Component/s: Upgrades
Affects Version/s: 10.5.4
Fix Version/s: 10.1.46, 10.2.33, 10.3.24, 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Dominique Ottello Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows 10 - 2004 64bit (10.19041)



 Description   

Hi,

E:\wamp64\bin\mariadb\mariadb10.5.4\bin>mariadb-upgrade-service.exe --service=wampmariadb64
FATAL ERROR: Not a valid MySQL service

This also happens with MariaDB 10.4.13 or 10.3.23.
This happens if service is created either with the Windows SC command or the (obsolete) mysqld.exe --install-manual command.

sc create wampmariadb64 binpath="E:\wamp64\bin\mariadb\mariadb10.5.4\bin\mysqld.exe --defaults-file=E:\wamp64\bin\mariadb\mariadb10.5.4\.\my.ini wampmariadb64"

E:/wamp64/bin/mariadb/mariadb10.5.4/bin/mysqld.exe --install-manual wampmariadb64 --defaults-file=E:\wamp64\bin\mariadb\mariadb10.5.4\my.ini



 Comments   
Comment by Vladislav Vaintroub [ 2020-07-05 ]

could you share the my.ini? where is the datadir located?

I assume this does not happen if the service was created with mysql_install_db.exe ?

Comment by Dominique Ottello [ 2020-07-06 ]

mariadb 10.5.4 is located e:\wamp64\bin\mariadb\mariadb10.5.4\ with "normal" bin and data folders.
my.ini is E:\wamp64\bin\mariadb\mariadb10.5.4\my.ini

; The following options will be passed to all MariaDB clients
[client]
port = 3306
socket = /tmp/mariadb.sock
 
; Here follows entries for some specific programs
; The MariaDB server
[wampmariadb64]
;skip-grant-tables
port = 3306
socket = /tmp/mariadb.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 2M
net_buffer_length = 8K
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
basedir="E:/wamp64/bin/mariadb/mariadb10.5.4"
log-error="E:/wamp64/logs/mariadb.log"
datadir="E:/wamp64/bin/mariadb/mariadb10.5.4/data"
 
;Path to the language
;See Documentation:
; https://mariadb.com/kb/en/mariadb/server-system-variables/#lc_messages
lc-messages-dir="E:/wamp64/bin/mariadb/mariadb10.5.4/share"
lc-messages=fr_FR
 
; Set the SQL mode
;sql-mode=""
;sql-mode="STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
 
; The default storage engine that will be used when create new tables
default-storage-engine=MYISAM
 
;To avoid warning messages
secure_file_priv="E:/wamp64/tmp"
skip-ssl
 
; Point the following paths to different dedicated disks
tmpdir="E:/wamp64/tmp"
 
; Replication Master Server (default)
; binary logging is required for replication
;log-bin=mysql-bin
 
; binary logging format - mixed recommended
;binlog_format=mixed
 
; required unique id between 1 and 2^32 - 1
; defaults to 1 if master-host is not set
; but will not function as a master if omitted
server-id = 1
 
innodb_data_file_path = ibdata1:12M:autoextend
; You can set .._buffer_pool_size up to 50 - 80 %
; of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
;innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 64M
innodb_log_buffer_size = 32M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_flush_method=normal
 
[mysqldump]
quick
max_allowed_packet = 16M
 
[mysql]
no-auto-rehash
 
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
 
[mysqlhotcopy]
interactive-timeout
 
[mysqld]
port = 3306

mysql_install_db.exe is only used to create datadir when installing the related version of MariaDB.
Since the first use of MariaDB (5.5.54) the service has always been created by mysqld.exe --install-manual and now by the Windows sc command.

Comment by Dominique Ottello [ 2020-07-06 ]

> I assume this does not happen if the service was created with mysql_install_db.exe ?
Since mysql_install_db.exe exists, i.e. since the data folder is no longer part of the mariadb distribution, I don't use it to create the service for several reasons:

  • 1 - inability to specify --defaults-file
  • 2 - defaults-file specified in the service is always E:\wamp64\bin\mariadb\mariadbx.y.z\data\my.ini
  • 3 - since the beginning of time, my file has always been E:\wamp64\bin\mariadb\mariadbx.y.z\my.ini.
  • 4 - the my.ini file is always recreated, the existing one is not taken into account
  • 5 - automatic service start
  • 6 - Impossibility to specify a manual start of the service

Indeed, if the service was created by mysql_install_db.exe, there is no FATAL ERROR.
Looking at mysql_upgrade_service.wampmariadb64.log, it would seem that mariadb-upgrade-service.exe does not do much more than mysql_upgrade.exe which does not cause any problem and which I have been using for a long time.

Comment by Vladislav Vaintroub [ 2020-07-06 ]

Thanks. Since you confirmed, I removed "no matter how the service was created" from description.

Comment by Vladislav Vaintroub [ 2020-07-06 ]

Thank you for your feedback.

To your others points, I guess 1-3 is the same (though, since the beginning of time in MariaDB, the my.ini was in data folder) 5-6 are also the same. 4 is trivially fixed, it does not preclude you from copy/override the newly created one with your own.

Let me give an explanation on why we do things the way we do, and tell you about some things you might not be aware of.

  • my.ini inside a datadir, is a conscious decision made in 2011-12, if you always put my.ini into the installation root, you can have 1 service per installation. if you put it into a datadir , you can have as many as you like
  • The most important thing, why mysqld --install should never be used to install MariaDB, or MySQL is that it runs with the most powerful account on Windows, LocalSystem , which it does not need, and this is a serious security vulnerability . Nobody runs mysqld as OS "root" account on Unixen, and you should not do that on Windows, either. The OS account MariaDB is using (NetworkService prior to 10.6, and "NT SERVICE\<service_name>" after 10.6) are the least powerful "service" accounts (i.e the ones that need no password to run). They can't write outside of data directory. They can write inside the data directory, because mysql_install_db.exe explicitly allows that by explicitly setting directory permissions on data directory. If you insist on creating service on your own, .eg with "sc", I highly recommend doing the same thing, setting permissions for the least powerful service account , and using "obj" with "sc create"

  • The mysql_upgrade_service does do a little more than you might have noticed. It does an Innodb "slow shutdown", and if you do not run a slow shutdown, prior to upgrade, you might not be able to start your service in the new path, due to the changed redo log format.
  • 5. and 6. manual is trivially fixed with "sc config [service name] start=manual"

default-storage-engine=MYISAM, is that the WAMP default?

Comment by Dominique Ottello [ 2020-07-06 ]

Instead of removing "no matter how the service was created" which will make the description ambiguous, I think it would be better to be positive and specify, for example "mariadb-upgrade-service.exe only supports services created by mysql_install_db.exe" or something like that.

Comment by Vladislav Vaintroub [ 2020-07-06 ]

Unfortunately, it claims to support the services created with obsolete mysqld --install. I think I fixed the description so that there is no ambiguity.

Comment by Dominique Ottello [ 2020-07-06 ]

> default-storage-engine=MYISAM, is that the WAMP default?
It's been like this for more than sixteen years with MySQL before Wampserver also supports MariaDB.
This doesn't prevent you from creating tables using another engine.
Wampserver is primarily intended for beginners who want to learn about databases.
This has never created any problem for "those who know".

Comment by Vladislav Vaintroub [ 2020-07-06 ]

it is just my opinion, but have a surprising effect for those beginners who learn about databases, to find out that ROLLBACK statement, as in SQL standard, does not work, and they should be using a non-standard extension ENGINE= , to make it work.
On one hand, backward compatibility is commendable, yet given that Innodb has been default engine in MySQL for half of Wampserver existence, or longer, perhaps it could be a time to reconsider.

Comment by Vladislav Vaintroub [ 2020-07-06 ]

I fixed it in 10.1, and it will be merged up to 10.6, at some point.

The problem with that my.ini file is that it uses service name instead of expected [mysqld], so the datadir was not determined, thus FATAL ERROR without much context.

Generated at Thu Feb 08 09:19:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.