MariaDB won't start automatically

Hello,

I have problems with MariaDB. Installation works well, MariaDB is running fine, too.
But it won't start after boot automatically and service command do not work.

Code:
root@thesaurus:/home/XXX # /usr/local/etc/rc.d/mysql-server status
mysql is running as pid 1417.
root@thesaurus:/home/XXX # service mysql-server status
 * rc-service: service `mysql-server' does not exist

I installed "mariadb103-server-10.3.11 Multithreaded SQL database (server)" - the latest avaiable version with pkg.

Starting MariaDB with "/usr/local/etc/rc.d/mysql-server start" works well, same stopping and status...

The permissions looks ok, too. So in the end I'm happy about all except that it's not booting automatically. As I know "/usr/local/etc/rc.d/*" is the directory for the scripts to be started after boot - or I'm wrong about that?
And how can I register the service?

Other applications are working in this way, I don't know what I did wrong on MariaDB or how I can fix it.

Have someone an idea?

Thanks so much for help.

Greats Thomas
 
Yes, after installing I added this line with the command:
sysrc mysql-server_enable="yes"

After the network settings there are the following lines on /etc/rc.conf:
Code:
mysql_pidfile="/var/db/mysql/mysql.pid"
mysql_optfile="/usr/local/etc/my.cnf"
mysql-server_enable="yes"

So this looks ok for me.
 
It's mysql_enable="YES", for MySQL, so I assume it's the same for MariaDB. Taking a quick peek inside the start script is usually enlightening.
 
Mmh, that's right - but that I tried before. Further I just installed a new VM and tried it with sysrc mysql_enable="yes"

Except doing the /usr/local/bin/mysql_secure_installation it's same fresh installation - the rc.conf is:
Code:
root@thesaurus2:/home/XXX # cat /etc/rc.conf
# Auto-Enabled NICs from pc-sysinstall
ifconfig_em0="inet XXX netmask XXX"
defaultrouter="XXX"
hostname="XXX"
mysql_enable="yes"
root@thesaurus2:/home/XXX # /usr/local/etc/rc.d/mysql-server status
mysql is running as pid 1749.
root@thesaurus2:/home/XXX # service mysql-server status
 * rc-service: service `mysql-server' does not exist
root@thesaurus2:/home/XXX # service mysql status
 * rc-service: service `mysql' does not exist

Before I installed only MariaDB with pkg install mariadb103-server-10.3.11
After that the sysrc command.

The DB is working as it should - don't know how to get the service registered :confused:

I don't know what I'm doing wrong.
 
Note that service only refers to the name of the start/stop scripts in (/usr/local)/etc/rc.d, not to the required entry in /etc/rc.conf. Yes, they are almost always the same, but never count on it. Anyway, if mysql_enable is properly defined, the start script should show up in service -e. If it doesn't, something else is going wrong. Also check the output of service mysql-server rcvar, it should produce mysql_enable="YES". This shows that /etc/rc.conf and the start/stop script see each other, so to speak.
 
Thanks for your help. Unfortunately I could not solve the problem yet.

Trying service -e do not show any output. I show to service -l but couldn't find something with "mysql". I tried service -e for some services on service -l list - but there's no output of it, too.
Code:
root@thesaurus:/home/XXX # service -e mysql
root@thesaurus:/home/XXX # service -e mysql-server
root@thesaurus:/home/XXX # service -l|grep mysql

Output for service mysql-server rcvar show me the known message:
Code:
root@thesaurus:/home/XXX # service mysql-server rcvar
 * rc-service: service `mysql-server' does not exist
root@thesaurus:/home/XXX # service mysql rcvar
 * rc-service: service `mysql' does not exist

Further I tried it with capital letters:
Code:
root@thesaurus:/home/XXX # sysrc mysql_enable="YES"
mysql_enable: yes -> YES
root@thesaurus:/home/XXX # cat /etc/rc.conf
# Auto-Enabled NICs from pc-sysinstall
ifconfig_em0="inet XXX netmask XXX"
defaultrouter="XXX"
hostname="XXX"
mysql_enable="YES"
root@thesaurus:/home/XXX # service mysql-server rcvar
 * rc-service: service `mysql-server' does not exist

So it changed sucessfully to capital letters, but didn't solved it :confused:

I don't understand what's going wrong - it's a clean installation of current release. Using same way other services on other installations are working well, only the database won't work :(

Greats Thomas
 
It could make me desperate. What is working: Writing a own script starting the mysql-server start script or starting as cronjob with @reboot - yeah, it's a solution. Not a very nice one, though.

Last way is a easy one way and working for now. I hope there will be a way to fix it ...

I don't know the cause of the problem because lot of other services working as it should and will be registered - it's only MariaDB having this problem. I activated the debug logging - but got nothing about the problem, looking to the log have nothing about mysql/mariadb :/
 
All rc(8) scripts use the checkyesno function from /etc/rc.subr for this. So it shouldn't matter if you used lower, upper or even camel case. Actually, true or on or 1 are also accepted.

Code:
checkyesno()
{
        eval _value=\$${1}
        debug "checkyesno: $1 is set to $_value."
        case $_value in

                #       "yes", "true", "on", or "1"
        [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
                return 0
                ;;

                #       "no", "false", "off", or "0"
        [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
                return 1
                ;;
        *)
                warn "\$${1} is not set properly - see rc.conf(5)."
                return 1
                ;;
        esac
}
 
Yeah and that's working as it should. But MariaDB won't be started automatically and isn't recognized command on service

Comparing different scripts of other application there's no other way but it's working. So is there any other place there the "service" command will be handled to recognize it?
 
As far as I know all the various MySQL and MariaDB versions we have in the ports tree use pretty much the exact same /usr/local/etc/rc.d/mysql-server rc(8) script. Although I have MariaDB 10.2 I don't think the scripts are different from 10.3:
Code:
root@molly:~ # service mysql-server status
mysql is running as pid 34517.
root@molly:~ # pkg info -x mariadb
mariadb102-client-10.2.30
mariadb102-server-10.2.30
root@molly:~ # service -e | grep mysql
/usr/local/etc/rc.d/mysql-server

Make sure your rc.conf doesn't have that mysql-server_enable any more. If I remember correctly that dash in the name really throws off the whole system causing all sorts of weird issues.
 
Running into something like this right now on FreeBSD 14.1 with mariadb114-server. mysql-server first-time start shows some help text, but then it isn't running after that. I for-certain have mysql_enable="YES" in rc.conf and nothing odd.

With MySQL server, the service expectedly stays active and then allows for secure-install.

This straight-up says to downgrade from the latest package?

Not sure how to debug a service, but I couldn't get mariadb114-server working. mariadb1011-server starts fine!
 
Back
Top