0

I just installed the latest version of ubuntu on usb. First I run sudo apt update, then sudo apt install apache2. So far everything was fine. But when I run sudo apt install mysql-server I get this error:

Setting up mysql-server-5.7 (5.7.24-0ubuntu0.18.04.1) ... Renaming removed key_buffer and myisam-recover options (if present) ERROR:
Unable to start MySQL server: mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 13 - Permission denied) mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

I am lost here. I run sudo chmod -R 755 /etc/mysql/conf.d/ and it didnt help. What could be the reason for this, why it shows permission denied if I chmoded the dir?

The output of ls -lhd /etc/mysql/conf.d is drwxr-xr-x 2 root root 4.0K nov 10 20:55 /etc/mysql/conf.d

UPDATE After restarting my laptop and running the sudo apt install mysql-server the permission error doesnt show up anymore, but now I get another errror

ubuntu@ubuntu:~$ journalctl -xe An error was encountered while opening
journal file or directory
/var/log/journal/d83633b7cd754897927e2a87e67fd985/system@7f9cc60cd768485c982d8183c054e0ba-0000000000000001-00057a56ce4251c4.journal,
ignoring file: Identifier removed
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the res
-- the configured Restart= setting for the unit. nov 10 22:24:49 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has finished shutting down. nov 10 22:24:49 ubuntu systemd[1]: mysql.service: Start request repeated too qui nov
10 22:24:49 ubuntu systemd[1]: mysql.service: Failed with result
'exit-code' nov 10 22:24:49 ubuntu systemd[1]: Failed to start MySQL
Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has failed.
-- 
-- The result is RESULT. nov 10 22:24:54 ubuntu sudo[2810]: pam_unix(sudo:session): session closed for us lines 1129-1151/1151
(END)
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit. nov 10 22:24:49 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has finished shutting down. nov 10 22:24:49 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
nov 10 22:24:49 ubuntu systemd[1]: mysql.service: Failed with result
'exit-code'. nov 10 22:24:49 ubuntu systemd[1]: Failed to start MySQL
Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has failed.
-- 
-- The result is RESULT. nov 10 22:24:54 ubuntu sudo[2810]: pam_unix(sudo:session): session closed for user root
  • /etc/mysqle/conf.d/ - is exist? – mature Nov 10 '18 at 21:55
  • Yes it does exists – user1324762 Nov 10 '18 at 22:03
  • run ls -lhd /etc/mysqle/conf.d and check rights and owners – mature Nov 10 '18 at 22:09
  • drwxr-xr-x 2 root root 4,0K nov 10 20:55 /etc/mysql/conf.d – user1324762 Nov 10 '18 at 22:19
  • Please run journalctl -xe and add to your question not your comments. – George Udosen Nov 10 '18 at 22:21
1

After all I installed Ubuntu to hard drive instead running it from usb and after that everything went smoothly.

| improve this answer | |
0

I recently had a problem with apparmor and mysql when I upgraded a server to 18.04. My impression is that the apparmor rules are not properly added on install/upgrade of mysql-server.

For a quick check you could just disable apparmor and see if it works:

sudo systemctl stop apparmor.service

If that's the case you may probably have to fix the apparmor rules by hand in /etc/apparmor.d/usr.sbin.mysqld, in your case specifically

  /etc/mysql/** r,

Hope this helps!

| improve this answer | |
0

FWIW:

stop apparmor:

sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown

create an empty file on /etc/apparmor.d/usr.sbin.mysqld

cleanup all dpkg packages and re-run the install.

When prompted with something like below make sure to select Y:

Configuration file '/etc/apparmor.d/usr.sbin.mysqld'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** usr.sbin.mysqld (Y/I/N/O/D/Z) [default=N] ? Y

(I was successful)

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.