You are not logged in.

#1 2018-06-17 13:22:58

danSman
Member
Registered: 2017-12-21
Posts: 47

[SOLVED] mariaDB - problem to change the path

Hi

I have a problem to change the path of mariadb.

I followed one day the instruction from the wiki. Might be 3 month ago. So, mariadb is working great.

Now I would like to change the path to my external hard drive which is mounted in /mnt/harddrive.
The harddrive is with LUKS encrypted and with fstab mounted. The defaults are set up in fstab. The filesystem of the hard drive is ext4.

I copied the 'cp -R -p /var/lib/mysql /mnt/harddrive/'
and changed or added the my.conf file.
datadir=/mnt/harddrive/mysql

When I restart the service I get this problem.
[Warning] Can't create test file /mnt/harddrive/mysql/dan.lower-test
[112B blob data]
I researched for it but i couldn't find any ways which worked. I tried a couple of things like a soft link with the same result. Is it might be the problem with fstab/mount and the defaults?
I have similar problems with radicale. I wanted to change the collection path to harddrive as well. For some reasons aren't the right permissions as well. But the permissions are copied like the command above.
It seems to be that the hard drive isn't properly mounted for mysql or radicale.

fstab entry
/dev/mapper/harddrive /mnt/harddrive ext4 defaults 0 2
or crypttab?
harddrive /dev/sda /secretfolder/.key luks

Other then that the harddrive is working fine. I can mv things around and add files here and there etc. Samba is running as well.

Hm ...

Thank You.

Last edited by danSman (2018-06-18 00:19:12)

Offline

#2 2018-06-17 13:37:11

progandy
Member
Registered: 2012-05-17
Posts: 5,199

Re: [SOLVED] mariaDB - problem to change the path

What are the permissions and owner of /mnt/harddrive/mysql?

Last edited by progandy (2018-06-17 13:40:57)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2018-06-17 14:05:19

danSman
Member
Registered: 2017-12-21
Posts: 47

Re: [SOLVED] mariaDB - problem to change the path

Hi
drwx------ 10 mysql mysql 4096 Jun 18 00:57 mysql

Offline

#4 2018-06-17 14:09:00

progandy
Member
Registered: 2012-05-17
Posts: 5,199

Re: [SOLVED] mariaDB - problem to change the path

Are you running a kernel security module like apparmor that prevents access there for mariadb?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2018-06-17 14:12:18

danSman
Member
Registered: 2017-12-21
Posts: 47

Re: [SOLVED] mariaDB - problem to change the path

No

Offline

#6 2018-06-17 15:00:41

progandy
Member
Registered: 2012-05-17
Posts: 5,199

Re: [SOLVED] mariaDB - problem to change the path

Then it might to be caused by the systemd directive ProtectSystem=full. I don't see why this would protect a /mnt path, but you could try adding an exception with ReadWritePaths=/mnt/harddrive/mysql or remove the protection.
https://jira.mariadb.org/browse/MDEV-13896


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2018-06-17 23:58:52

danSman
Member
Registered: 2017-12-21
Posts: 47

Re: [SOLVED] mariaDB - problem to change the path

Thanks for your help so far.

I changed the systemd. Put the ReadWritePaths in it and I commend #ProtectSystem without any changes.

The only thing what I add to the config was the datadir. Do I have to put something "special" in it as well?
# The MariaDB server
[mysqld]
port            = 3306
socket          = /run/mysqld/mysqld.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
datadir=/mnt/harddrive/mysql

I can't find the f problem...

I'll try another USB Stick. It might be a problem there...

EDIT:
BLOODY HELL!!!
Sometimes it's just to easy ...
For some reason, I changed the permissions of the harddrive-folder one day.
drwxr-x---
drwxr-xr-x

Sorry ;D

Last edited by danSman (2018-06-18 00:18:48)

Offline

Board footer

Powered by FluxBB