LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   Permission issue in Centos 7 (https://www.linuxquestions.org/questions/centos-111/permission-issue-in-centos-7-a-4175574508/)

airtonjal 03-10-2016 08:51 AM

Permission issue in Centos 7
 
Hi,

I need to change the MariaDB datadir in Centos 7. The default execution works fine, but when I set the datadir property inside /etc/my.cnf I cannot start the process:

Code:

[mariadb@localhost ~]$ sudo systemctl start mariadb
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
[mariadb@localhost ~]$ sudo journalctl -xe
Mar 10 10:35:55 localhost.localdomain mysqld[41857]: 2016-03-10 10:35:55 [ERROR] mysqld: Can't create/write to file '/home/mariadb/tmp/ibpGvyL9'
(Errcode: 13 "Permission denied")

permissions seems ok:

Code:

[mariadb@localhost ~]$ ls -lsa
0 drwx------  4 mariadb mariadb 148 Mar 10 10:27 .
0 drwxr-xr-x. 5 root    root    60 Mar 10 10:11 ..
0 drwxr-xr-x  2 mysql  mysql    10 Mar 10 10:23 data
0 drwxr-xr-x  2 mysql  mysql    10 Mar 10 10:27 tmp

Also, selinux is disabled:

Code:

[mariadb@localhost ~]$ getenforce
Disabled
[mariadb@localhost ~]$ sestatus
SELinux status:                disabled

Here's an output for the disk space used:

Code:

[mariadb@localhost ~]$ df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  50G  1.9G  49G  4% /
devtmpfs                  65G    0  65G  0% /dev
tmpfs                    65G    0  65G  0% /dev/shm
tmpfs                    65G  8.9M  65G  1% /run
tmpfs                    65G    0  65G  0% /sys/fs/cgroup
/dev/sda2                497M  170M  327M  35% /boot
/dev/mapper/centos-home  9.1T  6.4G  9.1T  1% /home
tmpfs                    13G    0  13G  0% /run/user/0

Any ideas what might be causing the permission issue??

Thanks in advance

cliffordw 03-10-2016 09:20 AM

Hi,

Quote:

Originally Posted by airtonjal (Post 5513246)
permissions seems ok:

Code:

[mariadb@localhost ~]$ ls -lsa
0 drwx------  4 mariadb mariadb 148 Mar 10 10:27 .
0 drwxr-xr-x. 5 root    root    60 Mar 10 10:11 ..
0 drwxr-xr-x  2 mysql  mysql    10 Mar 10 10:23 data
0 drwxr-xr-x  2 mysql  mysql    10 Mar 10 10:27 tmp


Which user is running the database server - mysql (default) or mariadb? Assuming the listing above is for /home/mariadb, they look wrong to me. The mariadb user doesn't have access to "tmp", while the mysql user doesn't have access to ".".

airtonjal 03-10-2016 10:44 AM

Hi cliffordw, thanks for the help.

I'm running with mariadb user, you are right that is /home/mariadb dir. I tried setting the owner and group both to mariadb (chown mariadb:mariadb) but it didn't work.

Elaborating a little more, whenever I set datadir, tmpdir and log_error in /etc/my.cnf I get a permission error, regardless of permission/group. I even tried with root user and some other directory options, but all of them hits the same error.

Any other ideas??

Thanks

cliffordw 03-10-2016 10:58 AM

Hi,

Have you tried changing the owner of "data" and "tmp" to mariadb?

airtonjal 03-10-2016 11:05 AM

Hey cliffordw,

yes I did, same error :/

airtonjal 03-10-2016 02:52 PM

Found the issue, it was mysql related, thanks anyway!


All times are GMT -5. The time now is 01:42 PM.