0

I installed mariaDB under the path ‘/app/mysql’;

Since the configuration file could not be found, I created the 'my.cnf' file under the 'etc/mysql' path and copied the content online, my.cnf CODE:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

When I run the command systemctl start mariadb, no error seems to be reported, but systemctl status mariadb says it failed. Code:

[root@iZbp13edmlpcdqu2759ccaZ system]# systemctl status mariadb
● mariadb.service - MariaDB - database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2023-10-19 20:31:46 CST; 13s ago
  Process: 115928 ExecStart=/app/mysql/bin/mysql -c /app/mysql (code=exited, status=1/FAILURE)
 Main PID: 115928 (code=exited, status=1/FAILURE)

Oct 19 20:31:46 iZbp13edmlpcdqu2759ccaZ systemd[1]: Started MariaDB - database server.
Oct 19 20:31:46 iZbp13edmlpcdqu2759ccaZ systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Oct 19 20:31:46 iZbp13edmlpcdqu2759ccaZ systemd[1]: mariadb.service: Failed with result 'exit-code'.

mariadb.service code:

[Unit]
Description=MariaDB - database server
After=syslog.target
After=network.target

[Service]
Type=simple
User=mysql
Group=mysql


# ExecStartPre=/app/mysql/bin/mysql -t -c  /app/mysql

ExecStart=/app/mysql/bin/mysql -c  /app/mysql
ExecStop=/app/mysql/bin/mysql -s stop


PrivateTmp=true

[Install]
WantedBy=multi-user.target

I hope to start mariadb successfully. How should I modify it? Thanks for any help.

10
  • 2
    Please don't post pictures of text. Post the text instead! The question editor has a special "code formatting" button for that. Oct 19, 2023 at 10:44
  • 1
    By the way, reading the error message tells you what's wrong Oct 19, 2023 at 10:46
  • 3
    (also, it's a bit questionable that you install MariaDB yourself. Why that? does your Linux distro not have a better way of installing it?) Oct 19, 2023 at 10:47
  • man systemd.service says that ExecQuit isn't an option in service files
    – admstg
    Oct 19, 2023 at 12:04
  • 4
    are you really intending to start mysql and not mysqld? Oct 19, 2023 at 13:35

1 Answer 1

0

If you build with cmake -DCMAKE_INSTALL_PREFIX=/app/mariadb ../mariadb-source (its not mysql which is why I'm using '/app/mariadb') and compile, you'll find the generated systemd file in /app/mariadb/support-files/systemd/mariadb.service.

Like the comments suggest, mysql is a client connection tool (now named mariadb) and inventing options like -c /app/mysql and -s stop won't mangicly make it behave like a service manager.

Even if you want to invent your own, look at the existing version, its service many users and been pretty reliable, and its author (me) wasn't totally mad.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .