Missing /var/run/mysql/mysql.sock after FreeBSD upgrade 12.2 to 13.2

Hello.
I'm unable to get Mariadb 10.6 mysql.sock working from /var/run/mysql/ after upgrading to FreeBSD to 13.2 from 12.2.
I've taken the opportunity to update php to 8.1. So far, I think the OS upgrade went well, and the previously installed pkgs and ports worked, except for Mariadb.
I have checked directory permissions and user permissions, and they are correct what it should be.
I've used pkg install mariadb106-server-10.6.14 at first, then pkg delete it... and moved down pkg mariadb105, and even built the last one using ports, after deleting the previous pkgs.

# service mysql-server start says "Starting mysql.", but service mysql-server status says "mysql is not running.".
There are no error logs to help too.

If I change the socket statement in /usr/local/etc/mysql/my.cfn to
Code:
socket    = /tmp/mysql.sock
and then run
Code:
/usr/local/bin/mysqld_safe --datadir='/var/db/mysql' &

It works partially, in doing that I get...:
Code:
# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.14-MariaDB FreeBSD Ports

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> exit
Bye

However ...
Code:
# service mysql-server status
mysql is not running.
 
... just finding some time to follow up further on this MariaDB upgrade. This is being done on home-test-server, and because "service mysql-server status" reports "mysql is not running", when it is...:
Code:
# ps -aux | grep sql
root   9244   0.0  0.0  13660   3260  1  I    Thu22       0:00.02 /bin/sh /usr/local/bin/mysqld_safe --datadir=/var/db/mysql
mysql  9335   0.0  1.6 630492 129512  1  I    Thu22       0:17.83 /usr/local/libexec/mariadbd --basedir=/usr/local --datadir=/var/db/mysql --plugin-dir=/usr/local/lib/mysql/plugin --u
root  16138   0.0  0.0  12892   2448  1  S+   19:23       0:00.00 grep sql

On OS reboots/restarts, it doesn't automatically start, and I had to run the /usr/local/bin/mysqld_safe --datadir='/var/db/mysql' to get it up. I do have mysql_enabled=YES in /etc/rc.conf.

I copied mysql.server to /usr/local/etc/rc.d/ I got:
Code:
# cp -p /usr/local/share/mysql/mysql.server /usr/local/etc/rc.d/
# service mysql.server status
 ERROR! MariaDB is not running, but PID file exists
and in directory /usr/local/libexec
Code:
# ls -l m*
-rwxr-xr-x  1 root  wheel  19398104  9 Oct 04:11 mariadbd
lrwxr-xr-x  1 root  wheel         8  9 Oct 04:11 mysqld -> mariadbd

Whereas in /usr/local/libexec for 10.4.17-MariaDB it gives
Code:
# ls -l m*
lrwxr-xr-x  1 root  wheel         6 14 Nov  2020 mariadbd -> mysqld
-rwxr-xr-x  1 root  wheel  18669816 14 Nov  2020 mysqld

I do get power outages at home, and Monit sends me an email, but can't start up mariadb when "service" for it doesn't work. Does anyone have a clue? Thanks.
 
I copied mysql.server to /usr/local/etc/rc.d/ I got:
Why are you doing this? Remove that file and reinstall MariaDB so the original rc(8) script is installed again.


Look in the mysql error log (/var/log/mysql/mysqld.err) why it failed to start.
 
I assume when you start the mariadbd daemon "manually" by executing mysqld_safe directly, then you are circumventing all the service mechanisms, hence service mysql-server status won't know that it's started and will therefore report it as such.

The differences in symlinks between 10.4 and later versions are expected. They are (slowly) moving away from pretending to be MySQL. It's a good thing.

You should be able to use mariadb-10.6 - I'd recommend using that.

As for the socket file, which is the real problem here, there could be several reasons for this.

But I would have thought changing the socket variable in /usr/local/etc/mysql/my.cnf (you meant .cnf, right, not .cfn?) to a location in /tmp/ would be a fine workaround (as long as you don't have anything that deletes /tmp/ contents automatically after x days ...). Did you try service mysql-server start after doing this change?

It's important that the socket variable is set for both server and client. Hence, it's best to set the variable only once - in the [client-server] section of your .cnf file, so that this value is picked up by both clients and servers. Make sure it's not set in different option files or sections e.g. in the /usr/local/etc/mysql/conf.d/ directory.
 
The default of MariaDB 10.5 is to have socket = /var/run/mysql/mysql.sock set in [client-server]. Sockets shouldn't be created in /tmp as they might get cleaned up (daily_clean_tmps_enable).
 
Sockets shouldn't be created in /tmp as they might get cleaned up (daily_clean_tmps_enable).
Ah, I was afraid of that! But using /tmp might still be useful as a test to eliminate the possibility of wrong permissions in the default socket location.
 
Back
Top