Status: "MariaDB server is down" - mysql

Hope someone can help me:
I have many sites running on my server and I am using mariadb.
when I do:
sudo service mysql restart
I get:
Job for mariadb.service failed because the control process exited with
error code. See "systemctl status mariadb.service" and "journalctl -xe"
for details.
systemctl status mariadb.service
mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Thu 2017-09-14 03:16:51 UTC; 1min 6s ago
Process: 13247 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=
Process: 13086 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/gale
Process: 13070 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, s
Process: 13033 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, st
Main PID: 13247 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
CGroup: /system.slice/mariadb.service
└─3803 /usr/sbin/mysqld
sudo journalctl -xe
Sep 14 03:35:51 ubuntu systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Sep 14 03:35:51 ubuntu systemd[1]: mariadb.service: Unit entered failed state.
Sep 14 03:35:51 ubuntu sudo[13566]: pam_unix(sudo:session): session closed for user root
Sep 14 03:35:51 ubuntu systemd[1]: mariadb.service: Failed with result 'exit-code'.
Sep 14 03:35:52 ubuntu sshd[13753]: Failed password for root from 123.183.209.136 port 38816 ssh2
Sep 14 03:35:52 ubuntu sshd[13753]: Received disconnect from 123.183.209.136 port 38816:11: [preauth]
Sep 14 03:35:52 ubuntu sshd[13753]: Disconnected from 123.183.209.136 port 38816 [preauth]
Sep 14 03:35:52 ubuntu sshd[13753]: PAM 1 more authentication failure; logname= uid=0 euid=0 tty=ssh ruser
Sep 14 03:36:34 ubuntu sshd[13756]: Connection closed by 123.183.209.136 port 60477 [preauth]
Sep 14 03:36:36 ubuntu postfix/pickup[12161]: 703AA5C0C5: uid=0 from=<root>
Sep 14 03:36:36 ubuntu postfix/cleanup[12162]: 703AA5C0C5: message-id=<20170914033636.703AA5C0C5#ubuntu.me
Sep 14 03:36:36 ubuntu postfix/cleanup[12162]: warning: 703AA5C0C5: write queue file: No space left on dev
Sep 14 03:36:36 ubuntu postfix/pickup[12161]: warning: maildrop/5152F5C0C4: error writing 703AA5C0C5: queu
Sep 14 03:37:17 ubuntu sshd[13760]: Received disconnect from 123.183.209.136 port 25567:11: [preauth]
Sep 14 03:37:17 ubuntu sshd[13760]: Disconnected from 123.183.209.136 port 25567 [preauth]
Sep 14 03:37:36 ubuntu postfix/pickup[12161]: 7764B5C0C5: uid=0 from=<root>
Sep 14 03:37:36 ubuntu postfix/cleanup[12162]: 7764B5C0C5: message-id=<20170914033736.7764B5C0C5#ubuntu.me
Sep 14 03:37:36 ubuntu postfix/cleanup[12162]: warning: 7764B5C0C5: write queue file: No space left on dev
Sep 14 03:37:36 ubuntu postfix/pickup[12161]: warning: maildrop/5152F5C0C4: error writing 7764B5C0C5: queu
Sep 14 03:37:47 ubuntu sudo[13765]: bob : TTY=pts/0 ; PWD=/home/bob ; USER=root ; COMMAND=/bin/journa
Sep 14 03:37:47 ubuntu sudo[13765]: pam_unix(sudo:session): session opened for user root by bob(uid=0)
lines 1238-1265/1265 (END)
I really don't want to lose my db.
What should I do next?
Many thanks
this is what df gives me:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 49362256 46854648 0 100% /
devtmpfs 2019828 0 2019828 0% /dev
tmpfs 2021768 0 2021768 0% /dev/shm
tmpfs 2021768 17968 2003800 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 2021768 0 2021768 0% /sys/fs/cgroup
tmpfs 404356 0 404356 0% /run/user/1000
tmpfs 404356 0 404356 0% /run/user/0

See the first filesystem (/dev/root) is 100% full! And there are no other volumes mounted besides tmpfs volumes. So mariadb is trying to write something to disk as it starts up, and can't, so it gives up and shuts itself down.
You have to figure out what's filling up your disk, and prune what you can. For example, as a guess I'd start by looking in the http server logs, since you say you host many sites on this server. I've seen many servers that filled up disk space by letting httpd log everything for months and months.
In the future, you might want to provision this server with more than one disk volume, so if one volume fills up it doesn't interfere with other volumes.
Also consider automating log rotation.
If the culprit for disk space usage is not logs, but is actually the mariadb data directory, then you might need to get an additional disk volume immediately, and move the mariadb content to it before you can bring your sites back online.
Unless you can find a little bit of other stuff elsewhere on the server that you can delete and make enough space for a short while.

Related

apt upgrade mysqlserver freezes and will not upgrade (ubuntu server 20.04)

I had to kill the session and then the databases are inaccessible until I reboot the server.
When I log back in and issue ‘apt upgrade’ i get the following error.
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
I run ‘dpkg --configure -a’ and get the following and then it just freezes
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 86150
On another tty
journalctl -xe gives this when the upgrade freezes.
-- The unit mysql.service has successfully entered the 'dead' state.
Jan 13 22:18:12 arpradio systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 582 and the job result is done.
Jan 13 22:18:13 arpradio audit[6057]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld" pid>
Jan 13 22:18:13 arpradio kernel: audit: type=1400 audit(1610572693.036:16): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="uncon>
When I reboot and login mysqld is running
I have tried the following.
# cp -r /etc/mysql /etc/mysql_old
# apt autoremove
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
# dpkg --configure -a
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 7451
And we are back here with the freeze.
If I check the mysql processes I find no process 7451 but this is the output.
# ps aux | grep mysql
root 1679 0.0 0.0 8644 4688 ? Ssl 22:23 0:00 dockerize -template /tmp/db.cnf.tmpl:/etc/mysql/conf.d/db.cnf /usr/local/bin/docker-entrypoint.sh mysqld
systemd+ 2526 0.3 0.1 2446780 99836 ? Sl 22:23 0:03 mysqld
root 7370 0.3 0.0 27940 19836 pts/0 S+ 22:38 0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-server-8.0.postinst configure 8.0.22-0ubuntu0.20.04.2
root 7379 0.0 0.0 9756 3772 pts/0 S+ 22:38 0:00 /bin/bash /var/lib/dpkg/info/mysql-server-8.0.postinst configure 8.0.22-0ubuntu0.20.04.2
mysql 7657 1.9 0.5 1869164 358336 pts/0 Sl+ 22:39 0:01 mysqld --user=mysql --init-file=/var/lib/mysql-files/tmp.gQukBE7GtT --socket=/tmp/tmp.KUFQmDDseF/mysqld.sock --pid-file=/tmp/tmp.KUFQmDDseF/mysqld.pid
root 7759 0.0 0.0 9032 724 pts/1 S+ 22:39 0:00 grep --color=auto mysql
I checked the status of mysql.service
# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2021-01-13 22:38:59 CET; 17min ago
Process: 649 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
Main PID: 649 (code=exited, status=0/SUCCESS)
Status: "Server shutdown complete"
Jan 13 22:21:43 arpradio systemd[1]: Starting MySQL Community Server...
Jan 13 22:21:45 arpradio systemd[1]: Started MySQL Community Server.
Jan 13 22:38:57 arpradio systemd[1]: Stopping MySQL Community Server...
Jan 13 22:38:59 arpradio systemd[1]: mysql.service: Succeeded.
Jan 13 22:38:59 arpradio systemd[1]: Stopped MySQL Community Server.
I fixed it, what I did was while the upgrade was hanging I ran
apt update && apt upgrade
on another tty and it upgraded everything, rebooted, I checked again after reboot and everything looks good.
# apt update
Hit:1 http://asi-fs-n.contabo.net/ubuntu focal InRelease
Hit:2 http://asi-fs-n.contabo.net/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 https://download.docker.com/linux/ubuntu focal InRelease
Hit:5 http://asi-fs-n.contabo.net/ubuntu focal-backports InRelease
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Fetched 109 kB in 1s (112 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root#arpradio:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#arpradio:~# ps aux | grep mysql
mysql 657 1.2 0.6 2067208 378684 ? Ssl 23:09 0:02 /usr/sbin/mysqld
root 2148 0.1 0.0 9796 4784 ? Ssl 23:11 0:00 dockerize -template /tmp/db.cnf.tmpl:/etc/mysql/conf.d/db.cnf /usr/local/bin/docker-entrypoint.sh mysqld
systemd+ 2930 0.8 0.1 2380944 99508 ? Sl 23:11 0:00 mysqld
root 5507 0.0 0.0 9032 732 pts/0 S+ 23:12 0:00 grep --color=auto mysql
root#arpradio:~# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-13 23:09:06 CET; 3min 26s ago
Process: 560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 657 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 72284)
Memory: 419.9M
CGroup: /system.slice/mysql.service
└─657 /usr/sbin/mysqld
Jan 13 23:09:04 arpradio systemd[1]: Starting MySQL Community Server...
Jan 13 23:09:06 arpradio systemd[1]: Started MySQL Community Server.

mysql does not restart

I've tried to restart mysql 5.7 :
service mysql restart
But it fails and i do not understand why :
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
And I dont see what's wrong in the logs :
systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 22:02:52 GMT; 1min 9s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 15467 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=127)
Main PID: 28679 (code=exited, status=0/SUCCESS)
Feb 25 22:02:52 stretch systemd[1]: Starting MariaDB 10.1.37 database server...
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Control process exited, code=exited status=127
Feb 25 22:02:52 stretch systemd[1]: Failed to start MariaDB 10.1.37 database server.
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Unit entered failed state.
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Failed with result 'exit-code'.
Any help would be welcome...
I'm on Debian 9, with 1800Mo in ram free.
Here is what the journal says :
journalctl -xe
Feb 26 08:09:01 stretch CRON[16792]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 26 08:09:01 stretch CRON[16793]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Feb 26 08:09:01 stretch CRON[16792]: pam_unix(cron:session): session closed for user root
Feb 26 08:17:01 stretch CRON[16794]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 26 08:17:01 stretch CRON[16795]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 26 08:17:01 stretch CRON[16794]: pam_unix(cron:session): session closed for user root
Feb 26 08:25:23 stretch systemd[1]: Starting MariaDB 10.1.37 database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has begun starting up.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Control process exited, code=exited status=127
Feb 26 08:25:23 stretch systemd[1]: Failed to start MariaDB 10.1.37 database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Unit entered failed state.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Failed with result 'exit-code'.
I also got this error when upgrading to Debian Buster (from MariaDB 10.1 to 10.3). Running mysqld myself and mysql_upgrade both worked anyways. Try executing the following command to restart systemd on the fly. See also https://unix.stackexchange.com/a/419375.
systemctl daemon-reexec
If you don't do this, a reboot will probably fix this as well. Commenting out the ExecStartPre in /etc/systemd/system/mysql.service was not enough as the other ExecStartPre commands then failed instead (also with the exit code 127, i.e. "command not found").
Under Process: is the ExecStartPre returning with an error exist status
Based on error 127, I'd suspect that /usr/bin/install doesn't exist.

Unable to restart MySQL server

I restarted MySQL server in one of the nodes in Percona Cluster.
Since the restart took much time, I interrupted the process. I tried restarting the MySQL server again. I got the following error:
Stale sst_in_progress file in datadir
I followed this link, https://www.percona.com/forums/questions-discussions/percona-xtradb-cluster/46846-sql-cluster-issue-need-help-please, and deleted the sst_in_progress file as mentioned in it.
Now, when I try restarting the MySQL server, I am getting this:
● mysql.service - LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-03-14 11:04:07 IST; 16min ago
Docs: man:systemd-sysv-generator(8)
Process: 23568 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Mar 14 11:04:00 systemd[1]: Starting LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon...
Mar 14 11:04:00 mysql[23568]: * Starting MySQL (Percona XtraDB Cluster) database server mysqld
Mar 14 11:04:00 /etc/init.d/mysql[23614]: MySQL PID not found, pid_file detected/guessed: /var/run/mysqld/mysqld.pid
Mar 14 11:04:07 mysql[23568]: * The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Mar 14 11:04:07 mysql[23568]: ...fail!
Mar 14 11:04:07 systemd[1]: mysql.service: Control process exited, code=exited status=1
Mar 14 11:04:07 systemd[1]: Failed to start LSB: Start and stop the mysql (Percona XtraDB Cluster) daemon.
Mar 14 11:04:07 systemd[1]: mysql.service: Unit entered failed state.
Mar 14 11:04:07 systemd[1]: mysql.service: Failed with result 'exit-code'.
One more thing is that no log is getting written to mysql-error.log file during restart because of which I am not able to continue debugging.
The best solution here, without being able to see more information, is to simply rm -rf $datadir and start the node back up. It will indeed SST which, depending on the dataset, will take a while. Estimate 1 hour for every 100GB of data over gigE.
If joiner node taking too much time so you can increase gcache.size upto 1 GB then restart joiner node, so if data is already there on new node so it will choose IST instead of SST.
set in my.cnf
wsrep_provider_options="gcache.size=1G"

MySQL Galera cluster can't initiate first node

I'm using Ubuntu 16.04 and installed MySQL version 5.7 via apt-get in AWS.
After that, I've managed to upgrade the MySQL to Galera Cluster by following the Documentation from the official website using apt-get install galera-3 galera-arbitrator-3 mysql-wsrep-5.6
After that I've configured the file /etc/mysql/conf.d/galera.cnf to be:
[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://this_node_ip,second_ip,third_ip"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="this_node_ip"
wsrep_node_name="this_node_name"
The step above is repeated for the other 2 nodes (with it's own IP address). And stop the mysql with the following command sudo service mysql stop for each of the node.
And in the first node, I'm trying to start with the following command:
sudo service mysql start --wsrep-new-cluster
But it returns: Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
In the systemctl status mysql.service, it says:
● mysql.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-02-09 15:53:16 +08; 33s ago
Docs: man:systemd-sysv-generator(8)
Process: 6264 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Feb 09 15:53:15 systemd[1]: Starting LSB: start and stop MySQL...
Feb 09 15:53:15 mysql[6264]: Starting MySQL
Feb 09 15:53:15 mysql[6264]: .180209 15:53:15 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
Feb 09 15:53:15 mysql[6264]: 180209 15:53:15 mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
Feb 09 15:53:16 mysql[6264]: * The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Feb 09 15:53:16 systemd[1]: mysql.service: Control process exited, code=exited status=1
Feb 09 15:53:16 systemd[1]: Failed to start LSB: start and stop MySQL.
Feb 09 15:53:16 systemd[1]: mysql.service: Unit entered failed state.
Feb 09 15:53:16 systemd[1]: mysql.service: Failed with result 'exit-code'.
Hope these information helps.

How can I reinstate a MariaDB server process that is simply no longer running?

For a particular project I wanted to have Mint (Sonja) appliance with all MariaDB and only MariaDB doing MySQL's work, without a hint of MySQL so I know I'm working with MariaDB.
The appliance is one where I've installed multiple open source projects that power their own website (Alfresco, Request Tracker, SuiteCRM, etc.), and all of them seem to have worked either with MariaDB, or just used Postgres without interesting difficulty, and up until I tried to create a new MariaDB database to add a clone of a specific Wordpress site, MariaDB worked predictably well with no headaches on the same system. Until now, where I can't seem to find a pulse.
The MariaDB troubleshooting page confirmed what I'd found in my investigations (in particular, a ps wwaux | grep mysql only turned up the grep process). The basic problem as I'd encountered it was when I tried to log in to create a database:
monk#toolchest ~ $ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
I've never gotten involved with MySQL's or MariaDB's /etc configuration files, but I looked briefly. They appeared sane to my uneducated eye.
Neither an aptitude reinstall mariadb-server nor a service mysql start produce any changes so far as I could tell.
For service mysql start, I got:
# service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
The details for systemctl status mysql.service were:
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-07-14 18:16:38 EEST; 1min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 5011 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: 0 processes alive and '/usr/bin/mysql
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: [61B blob data]
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: error: 'Can't connect to local MySQL
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: Check that mysqld is running and that
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]:
Jul 14 18:16:38 toolchest mysql[5011]: ...fail!
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Control process exited, code=exited
Jul 14 18:16:38 toolchest systemd[1]: Failed to start LSB: Start and stop the mysql data
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
The recent (i.e. non-cronned) content of journalctl -xe ran:
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
/etc/mysql/mariadb.cnf and /etc/mysql/my.cnf both read (comments stripped):
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
/etc/mysql/my.cnf.fallback dropps the latter !includedir. Commenting out the latter /etc/mysql/my.cnf to match the fallback file produced identical results.
I can edit my question to include more of /etc/mysql/*, but I wanted to ask. Error messages similar to the ERROR 2002 are to be found in questions like Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38), but these appear to be MySQL rather than MariaDB, and I suspect this may be a MariaDB-specific fluke.