Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5.45, 10.0.21, 10.1.6
-
None
Description
The mysql.server init script doesn't check all server configuration groups. This happens because it uses the following arguments to "my_print_defaults":
/usr/bin/my_print_defaults mysqld server mysql_server mysql.server
This causes a problem because the mysql.server script needs to use some of the server configuration options, such as datadir.
For example, let's say we have the following configuration file:
$ cat /etc/my.cnf.d/server.cnf
|
#
|
# These groups are read by MariaDB server.
|
# Use it for options that only the server (but not clients) should see
|
#
|
# See the examples of server my.cnf files in /usr/share/mysql/
|
#
|
|
# this is read by the standalone daemon and embedded servers
|
[server]
|
|
# this is only for the mysqld standalone daemon
|
[mysqld]
|
|
# this is only for embedded server
|
[embedded]
|
|
# This group is only read by MariaDB servers, not by MySQL.
|
# If you use the same .cnf file for MySQL and MariaDB,
|
# you can put MariaDB-only options here
|
[mariadb]
|
|
# This group is only read by MariaDB-10.0 servers.
|
# If you use the same .cnf file for MariaDB of different versions,
|
# use this group for options that older servers don't understand
|
[mariadb-10.0]
|
log_bin
|
binlog_format=ROW
|
server_id=1
|
skip_name_resolve
|
datadir=/exports/mysql
|
What does my_print_defaults give us with the arguments that mysql.server uses? Nothing, because it doesn't check the mariadb-10.0 configuration group:
$ /usr/bin/my_print_defaults mysqld server mysql_server mysql.server
|
If we instead use the --mysqld argument, then it finds the correct settings:
$ /usr/bin/my_print_defaults --mysqld
|
--log_bin
|
--binlog_format=ROW
|
--server_id=1
|
--skip_name_resolve
|
--datadir=/exports/mysql
|
A side-effect of this bug is that you can't set datadir in the mariadb-10.0 configuration group.
$ /usr/bin/my_print_defaults --mysqld | grep "datadir"
|
--datadir=/exports/mysql
|
$ sudo service mysql start
|
Starting MySQL. SUCCESS!
|
$ mysql -u root --execute="SHOW GLOBAL VARIABLES LIKE 'datadir'"
|
+---------------+-----------------+
|
| Variable_name | Value |
|
+---------------+-----------------+
|
| datadir | /var/lib/mysql/ |
|
+---------------+-----------------+
|
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
The mysql.server init script doesn't check all server configuration groups. This happens because it uses the following arguments to "my_print_defaults": /usr/bin/my_print_defaults mysqld server mysql_server mysql.server This causes a problem because the mysql.server script needs to use some of the server configuration options, such as datadir. For example, let's say we have the following configuration file: {noformat} $ cat /etc/my.cnf.d/server.cnf # # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] # This group is only read by MariaDB-10.0 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.0] log_bin binlog_format=ROW server_id=1 skip_name_resolve datadir=/exports/mysql {noformat} What does my_print_defaults give us with the arguments that mysql.server uses? Nothing, because it doesn't check the mariadb-10.0 configuration group: {noformat} $ /usr/bin/my_print_defaults mysqld server mysql_server mysql.server {noformat} If we instead use the --mysqld argument, then it finds the correct settings: {noformat} $ /usr/bin/my_print_defaults --mysqld --log_bin --binlog_format=ROW --server_id=1 --skip_name_resolve --datadir=/exports/mysql {noformat} A side-effect of this bug is that you can't set datadir in the mariadb-10.0 configuration group. {noformat} $ /usr/bin/my_print_defaults --mysqld | grep "datadir" --datadir=/exports/mysql $ sudo service mysql start Starting MySQL. SUCCESS! $ mysql -u root --execute="SHOW GLOBAL VARIABLES LIKE 'datadir'" +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ {noformat} |
The mysql.server init script doesn't check all server configuration groups. This happens because it uses the following arguments to "my_print_defaults": /usr/bin/my_print_defaults mysqld server mysql_server mysql.server See here: https://github.com/MariaDB/server/blob/2db62f686e148f09fe5fd0b385fc71f2a3c4a133/support-files/mysql.server.sh#L213 This causes a problem because the mysql.server script needs to use some of the server configuration options, such as datadir. For example, let's say we have the following configuration file: {noformat} $ cat /etc/my.cnf.d/server.cnf # # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] # This group is only read by MariaDB-10.0 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.0] log_bin binlog_format=ROW server_id=1 skip_name_resolve datadir=/exports/mysql {noformat} What does my_print_defaults give us with the arguments that mysql.server uses? Nothing, because it doesn't check the mariadb-10.0 configuration group: {noformat} $ /usr/bin/my_print_defaults mysqld server mysql_server mysql.server {noformat} If we instead use the --mysqld argument, then it finds the correct settings: {noformat} $ /usr/bin/my_print_defaults --mysqld --log_bin --binlog_format=ROW --server_id=1 --skip_name_resolve --datadir=/exports/mysql {noformat} A side-effect of this bug is that you can't set datadir in the mariadb-10.0 configuration group. {noformat} $ /usr/bin/my_print_defaults --mysqld | grep "datadir" --datadir=/exports/mysql $ sudo service mysql start Starting MySQL. SUCCESS! $ mysql -u root --execute="SHOW GLOBAL VARIABLES LIKE 'datadir'" +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ {noformat} |
Affects Version/s | 5.5.45 [ 19405 ] |
Summary | Init script doesn't check all applicable configuration groups | [PATCH] Init script doesn't check all applicable configuration groups |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 5.5 [ 15800 ] | |
Assignee | Sergei Golubchik [ serg ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Fix Version/s | 5.5.47 [ 20300 ] | |
Fix Version/s | 10.0.23 [ 20401 ] | |
Fix Version/s | 10.1.10 [ 20402 ] | |
Fix Version/s | 5.5 [ 15800 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 71021 ] | MariaDB v4 [ 149466 ] |
Pull request for 5.5 is here: https://github.com/MariaDB/server/pull/92