Dear readers of our blog, we'd like to recommend you to visit the main page of our website, where you can learn about our product SQLS*Plus and its advantages.
 
SQLS*Plus - best SQL Server command line reporting and automation tool! SQLS*Plus is several orders of magnitude better than SQL Server sqlcmd and osql command line tools.
 

REQUEST COMPLIMENTARY SQLS*PLUS LICENCE

Enteros UpBeat offers a patented database performance management SaaS platform. It proactively identifies root causes of complex revenue-impacting database performance issues across a growing number of RDBMS, NoSQL, and deep/machine learning database platforms. We support Oracle, SQL Server, IBM DB2, MongoDB, Casandra, MySQL, Amazon Aurora, and other database systems.

Check the configuration before starting the MySQL server

27 August 2020

MySQL Server

MySQL Server supports the validate-config option, which allows checking the startup configuration for problems without starting the server in normal operation mode:

  • If no errors are found, the server terminates with the output code 0.
  • If an error is found, the server displays a diagnostic message and terminates with output code 1.

Valate-config can be used at any time, but is especially useful after an upgrade to check if any options previously used with an older server, an upgraded server are considered obsolete or outdated.

MySQL version and configuration

First let’s have some information about my MySQL version and configuration.

$ mysqld --help --verbose | head -n13
mysqld Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
affiliates. Other may be trademarks of their respective
owners.

Starts the MySQL database server.

Usage: mysqld [OPTIONS].

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

We use MySQL server 8.0.16

The default configuration of the parameters is read in the specified order from:

/etc/my.cnf
/etc/mysql/my.cnf
/usr/local/mysql/etc/my.cnf
~ / .My.cnf

Now let’s check the start-up configuration of my MySQL server:

$ mysqld --validate-config
$

No error ! No output, everything looks good. Our server will start with this configuration. In case of an error the server will shut down.

The output is clearly different:

$ mysqld --validate-config --fake-option
2019-06-05T15:10:08.653775Z 0 [ERROR] [MY-000068] [Server] unknown option '--fake-option'.
2019-06-05T15:10:08.653822Z 0 [ERROR] [MY-010119] [Server] Aborting

Usually your configuration settings are written in your configuration file (usually with the name my.cnf).

So you can also use validate-config in this context:

$ mysqld --defaults-file=/etc/my.cnf --validate-config
$

Note:

  1. defaults-file, if specified, should be the first parameter on the command line.
  2. Alternatively, you can handle verbosity using log_error_verbosity:
  • A value of 1 gives you an ERROR
  • A value of 2 gives you ERROR and WARNING.
  • A value of 3 gives you an ERROR, WARNING AND INFORMATION (i.e. a note).

With a value of 2, in addition to errors, we will be able to display warnings:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
2019-06-05T15:53:42.785422Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-06-05T15:53:42.785660Z 0 [Warning] [MY-0101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.

Nothing particularly serious, but it is recommended to remove the warnings if possible.

Therefore, we have fixed these warnings:

Use binlog_expire_logs_seconds instead of expire-logs-days
Set the correct permissions for your secure-file-priv directory
$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
2019-06-05T16:04:32.363297Z 0 [ERROR] [MY-000067] [Server] unknown variable 'binlog_expire_logs_second=7200'.
2019-06-05T16:04:32.363369Z 0 [ERROR] [MY-010119] [Server] Aborting

Sorry !!! There is a misprint …: -0
We wrote binlog_expire_logs_second instead of binlog_expire_logs_seconds. (We forgot the last “s”). In this case my MySQL server cannot start.

Thanks to validate-config ! Now we can avoid unpleasant sensations when starting the server. If written correctly, we now have no errors or warnings:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
$

Note that you can also use value 3:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=3
2019-06-05T16:02:03.589770Z 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2019-06-05T16:02:03.590719Z 0 [Note] [MY-010733] [Server] Shutting down plugin 'MyISAM'.
2019-06-05T16:02:03.590763Z 0 [Note] [MY-010733] [Server] Shutting down plugin 'CSV'

It is convenient and can be very useful. It may be worth including it in the update process.

Note:

  1. Defaults-file, if specified, should be the first parameter on the command line.
  2. Alternatively, you can handle verbosity using log_error_verbosity:
  • A value of 1 gives you an ERROR
  • A value of 2 gives you ERROR and WARNING.
  • A value of 3 gives you an ERROR, WARNING AND INFORMATION (i.e. a note).

With a value of 2, in addition to errors, we will be able to display warnings:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
2019-06-05T15:53:42.785422Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-06-05T15:53:42.785660Z 0 [Warning] [MY-0101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.

Nothing particularly serious, but it is recommended to remove the warnings if possible.

Therefore, we have fixed these warnings:

  • Use binlog_expire_logs_seconds instead of expire-logs-days
  • Set the correct permissions for your secure-file-priv directory

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
2019-06-05T16:04:32.363297Z 0 [ERROR] [MY-000067] [Server] unknown variable 'binlog_expire_logs_second=7200'.
2019-06-05T16:04:32.363369Z 0 [ERROR] [MY-010119] [Server] Aborting

Sorry !!! There is a misprint …: -0
We wrote binlog_expire_logs_second instead of binlog_expire_logs_seconds. We forgot the last “s”. In this case my MySQL server cannot start. Thanks to validate-config! Now we can avoid unpleasant sensations when starting the server.

If written correctly, we now have no errors or warnings:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=2
$

Note that you can also use value 3:

$ mysqld --defaults-file=/etc/my.cnf --validate-config --log_error_verbosity=3
2019-06-05T16:02:03.589770Z 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2019-06-05T16:02:03.590719Z 0 [Note] [MY-010733] [Server] Shutting down plugin 'MyISAM'.
2019-06-05T16:02:03.590763Z 0 [Note] [MY-010733] [Server] Shutting down plugin 'CSV'

It is convenient and can be very useful. It may be worth including it in the update process.

 
Tags: , , ,

MORE NEWS

 

Preamble​​NoSql is not a replacement for SQL databases but is a valid alternative for many situations where standard SQL is not the best approach for...

Preamble​​MongoDB Conditional operators specify a condition to which the value of the document field shall correspond.Comparison Query Operators $eq...

5 Database management trends impacting database administrationIn the realm of database management systems, moreover half (52%) of your competitors feel...

The data type is defined as the type of data that any column or variable can store in MS SQL Server. What is the data type? When you create any table or...

Preamble​​MS SQL Server is a client-server architecture. MS SQL Server process starts with the client application sending a query.SQL Server accepts,...

First the basics: what is the master/slave?One database server (“master”) responds and can do anything. A lot of other database servers store copies of all...

Preamble​​Atom Hopper (based on Apache Abdera) for those who may not know is an open-source project sponsored by Rackspace. Today we will figure out how to...

Preamble​​MongoDB recently introduced its new aggregation structure. This structure provides a simpler solution for calculating aggregated values rather...

FlexibilityOne of the most advertised features of MongoDB is its flexibility.  Flexibility, however, is a double-edged sword. More flexibility means more...

Preamble​​SQLShell is a cross-platform command-line tool for SQL, similar to psql for PostgreSQL or MySQL command-line tool for MySQL.Why use it?If you...

Preamble​​Writing an application on top of the framework on top of the driver on top of the database is a bit like a game on the phone: you say “insert...

Preamble​​Oracle Coherence is a distributed cache that is functionally comparable with Memcached. In addition to the basic function of the API cache, it...

Preamble​​IBM pureXML, a proprietary XML database built on a relational mechanism (designed for puns) that offers both relational ( SQL / XML ) and...

  What is PostgreSQL array? In PostgreSQL we can define a column as an array of valid data types. The data type can be built-in, custom or enumerated....

Preamble​​If you are a Linux sysadmin or developer, there comes a time when you need to manage an Oracle database that can work in your environment.In this...

Preamble​​Starting with Microsoft SQL Server 2008, by default, the group of local administrators is no longer added to SQL Server administrators during the...