Install Mariadb On CentOS 7 Fails

Home » CentOS » Install Mariadb On CentOS 7 Fails
CentOS 6 Comments

Folks

I’m having problems installing Mariadb in CentOS 7.

Here’s what I did:

0) Become root
1) Make sure that mariadb and mysql are NOT installed.
2) Delete residual libs
rm -rf /var/lib/mysq*
3) yum install -y mariadb-server
installed mariadb-5.5.50-1.el7_2.x86_64 from the CentOS
‘updates’ repository
4) systemctl start mariadb
5) systemctl status mariadb

All works well until step 5, where I get the result:

# systemctl status mariadb
? mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled;
vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-09-22 17:46:38
PDT; 4min 3s ago
Main PID: 16261 (code=exited, status=1/FAILURE)

Sep 22 17:46:37 goat.xxx.com mysqld_safe[16261]:
/usr/bin/mysqld_safe: line 139: /var/log/mysqld.log: Permission denied Sep 22 17:46:37 goat.xxx.com mysqld_safe[16261]:
/usr/bin/mysqld_safe: line 183: /var/log/mysqld.log: Permission denied Sep 22 17:46:37 goat.xxx.com mysqld_safe[16261]: touch: cannot touch
`/var/log/mysqld.log’: Permission denied Sep 22 17:46:37 goat.xxx.com mysqld_safe[16261]: chown: cannot access
`/var/log/mysqld.log’: No such file or directory Sep 22 17:46:37 goat.xxx.com mysqld_safe[16261]: chmod: cannot access
`/var/log/mysqld.log’: No such file or directory Sep 22 17:46:37 goat.xxx.com systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Sep 22 17:46:38 goat.xxx.com systemd[1]: mariadb.service: control process exited, code=exited status=1
Sep 22 17:46:38 goat.xxx.com systemd[1]: Failed to start MariaDB
database server. Sep 22 17:46:38 goat.xxx.com systemd[1]: Unit mariadb.service entered failed state. Sep 22 17:46:38 goat.xxx.com systemd[1]: mariadb.service failed. Hint: Some lines were ellipsized, use -l to show in full.
[root@goat ~]#

My environment is a CentOS 7 installation running as a VM inside Vmware, and is not a production system. It is updated nightly.

When I examined the files alluded to,

/var/log/mysqld.log
does not exist but
/var/log/mariadb/mariadb.log
exists and is empty.

Adivce would be appreciated

Thanks

David

6 thoughts on - Install Mariadb On CentOS 7 Fails

  • Simply saying ‘sudo restorecon -R /var/log’ may fix it by resetting SELinux file permissions to their intended defaults.

    That won’t help if you have explicit SELinux labels applied to that one log file, though. The ls -lZ output (from after the restorecon command) would be necessary to understand the complaint from mysqld_safe in that case.

  • At 09:36 AM 9/23/2016, you wrote:

    Charles As the original note pointed out, /var/log/mysqld.log does not exist, as shown by these two commands:

    [root@goat ~]# ls -1F /var/log/mysqld.log ls: cannot access /var/log/mysqld.log: No such file or directory
    [root@goat ~]# ls -1Z /var/log/mysqld.log ls: cannot access /var/log/mysqld.log: No such file or directory
    [root@goat ~]#

    HOWEVER, /var/log/mariadb/mariadb.log does exist and is empty
    [root@goat ~]# ls -l /var/log/mariadb/*
    -rw-r—– 1 mysql mysql 0 Sep 23 10:08 /var/log/mariadb/mariadb.log

    David

  • At 09:36 AM 9/23/2016, you wrote:

    Charles As the original note pointed out, /var/log/mysqld.log does not exist, as shown by these two commands:

    [root@goat ~]# ls -1F /var/log/mysqld.log ls: cannot access /var/log/mysqld.log: No such file or directory
    [root@goat ~]# ls -1Z /var/log/mysqld.log ls: cannot access /var/log/mysqld.log: No such file or directory
    [root@goat ~]#

    HOWEVER, /var/log/mariadb/mariadb.log does exist and is empty
    [root@goat ~]# ls -l /var/log/mariadb/*
    -rw-r—– 1 mysql mysql 0 Sep 23 10:08 /var/log/mariadb/mariadb.log

    David

    PS: I forgot to say that SELinux is disabled:

    [root@goat ~]# getenforce Disabled
    [root@goat ~]#

  • In that case, the error means that user mysql doesn’t have write access to /var/log, which is as it should be, since my EL7 box says:

    $ ls -ld /var/log
    drwxr-xr-x. 21 root root 4096 Sep 18 03:28 /var/log/

    You need to configure MariaDB to write its logs to a directory it does have write access to, by default /var/log/mariadb. MariaDB is configured this way here:

    [mysqld_safe]
    log-error=/var/log/mariadb/mariadb.log

    If your /etc/my.cnf says something else, then the poster up-thread who guessed that you have an old my.cnf file nailed it. Unless you have precious configuration info in it, I’d replace it with /etc/my.cnf.rpmnew if it exists, or just remove it and reinstall the RPM.

    (Incidentally, you mistranscribed the commands we gave you. It’s an “l”, not a “1” in ls -lF and ls -lZ, though it doesn’t matter in this case.)

LEAVE A COMMENT