11

I'm installing mariadb on ubuntu 16.04.

After Installed, when I run mysql status/start, it always throws the below error

root@3ab94b27a215:~# service mysql status
/usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: Permission denied
* MariaDB is stopped. 

I find the file here

root@3ab94b27a215:~# find / -name liblz4.so.1
/usr/lib/x86_64-linux-gnu/liblz4.so.1

I set 777 permission to /usr/lib/x86_64-linux-gnu/liblz4.so.1

chmod 777  /usr/lib/x86_64-linux-gnu/liblz4.so.1

but still the error not resolved.

can you please help me on this?

Bilal Usean
  • 2,322
  • 3
  • 22
  • 45

3 Answers3

28

This worked for me :-

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/

sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

It also disables the AppArmor for MySQL on the system though.

Got from this issue

Prashant Verma
  • 381
  • 3
  • 3
2

This is what worked for me

Follow the steps below to remove mysqld from the app armor:

$ echo "/usr/sbin/mysqld { }" | sudo tee /etc/apparmor.d/usr.sbin.mysqld
$ sudo apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
$ sudo systemctl restart mariadb
AmaChefe
  • 395
  • 3
  • 8
0

Had the same problem after mariad install and changing datadir to /home/myuser/mysql. This was the issue: https://stackoverflow.com/a/41558145/4556066 ProtectHome=false

Samuel Tesler
  • 345
  • 2
  • 9