Please, check the following configuration files and variables:
File: /etc/mysql/my.cnf
[client]
...
ssl-ca=/var/lib/mysql/ca.pem
ssl-cert=/var/lib/mysql/client-cert.pem
ssl-key=/var/lib/mysql/client-key.pem
ssl-verify-server-cert
...
[mysqld]
...
ssl
ssl-ca=/var/lib/mysql/ca.pem
ssl-cert=/var/lib/mysql/server-cert.pem
ssl-key=/var/lib/mysql/server-key.pem
...
File: /etc/hosts
127.0.0.1 localhost CNSERVER
MariaDB Command-Line:
$ mysql -u root -p -h CNSERVER
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 10.1.14-MariaDB-1~xenial mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SHOW VARIABLES LIKE '%ssl%';
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | /var/lib/mysql/ca.pem |
| ssl_capath | |
| ssl_cert | /var/lib/mysql/server-cert.pem |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | /var/lib/mysql/server-key.pem |
| version_ssl_library | OpenSSL 1.0.2g-fips 1 Mar 2016 |
+---------------------+---------------------------------+
10 rows in set (0.00 sec)
MariaDB [(none)]> SHOW SESSION STATUS LIKE '%Ssl_version%';
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| Ssl_version | TLSv1.2 |
+---------------+---------+
1 row in set (0.00 sec)
Going off the documentation, the error log should be in the default location of /var/lib/mysql
and it should be named the default hostname.err
, but it's just not there.
In the directory /var/lib/mysql
I do have a tc.log
, iblogfile0
, iblogfile1
, aria_log.00000001
, and aria_log_control
files. But I cannot read any of them, they are encrypted. Anyone know what these are?
BUT, I am starting the service using service mysqld start command so I want to know what all options are used by default when we start the service using service mysql start? ESP, is --log-error used?
After running the following command,
cat /etc/systemd/system/mysqld.service | grep "mysql"
we can see that the line that systemd uses to start the process is ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
. The options passed to MariaDB are stored in the $MYSQLD_OPTS
variable.
If we also run cat /etc/systemd/system/mysqld.service | grep "MYSQLD_OPTS"
we get the following.
MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
Use the [Service] section and Environment="MYSQLD_OPTS=...".
ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
The file MY_SPECIAL.conf does not exist on my machine, as find / -name "*MY_SPECIAL*"
reveals.
I do have entries for mysqld
in journalctl
. So I'm thinking that it uses the the systemd
system logs by default for us systemd
users.
On the MariaDB Knowledge base page for the error-log there is a paragraph that states.
systemd
has its own logging system, and Linux distributions running systemd
may log errors there instead. To view the systemd logs, use journalctl -u mariadb
.
This answers the question because --log-error
would be an option that could be added to MY_SPECIAL.conf
file and journalctl
is where mariadb logs errors by default on a systemd
system.
Best Answer
Be aware that although mariadDB loads configuration details from various my.cnf files it can also load them from other files with different names.
That means that if you make a change in one of the my.cnf files, it may get overwritten by another file of a different name. To make the change stick, you need to change it in the right (last loaded) config file - or, maybe, change it in all of them.
So how do you find all the config files that might be loaded? Instead of looking for my.cnf files, try running:
This will find all the places in which datadir is mentioned. In my case, it produces this answer:
When I edit that file (/etc/mysql/mariadb.conf.d/50-server.cnf) to change the value for datadir (in my case to /media/USBHDD2/shared/mysql ), it works, whereas changing it in my.cnf does not.
However, you then have to make sure that the hard drive is mounted before mariadDB starts up, otherwise the startup will fail. And also make sure that the ownership of the directory and files on your mounted drive is mysql:mysql - a problem if the filestructure is ntfs rather than EXT4. see my own problem and solution here