Mysql server doesn't start on Ubuntu 16.04

15,081

Solution 1

I ran into this same problem and suspect it is related to apparmor.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865534

TL;DR - Try this:

  1. echo -n "/usr/sbin/mysqld" | sudo tee /sys/kernel/security/apparmor/.remove
  2. sudo service mysql start

Solution 2

You should read the logs you post, they actually contain useful information that you could use to solve the problem yourself.

170202 09:48:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/sbin/mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 13 - Permission denied)
Fatal error in defaults handling. Program aborted

Your startup failed because the permissions on /etc/mysql/mariadb.conf.d/ are incorrect.

I don't have an Ubuntu system to hand to check but it should be fairly straightforward to figure out what permissions are required. you probably need to give read(r) and/or traverse(x) permissions to either group or world.

Solution 3

There may be many reasons for the same error.

  1. Try stop and start again mysqld with sudo command sudo service mysqld stop and then sudo service mysqld start.
  2. check the memory if enough by using df -h command.
  3. if this will not work then please paste mongo.cnf with your question.
Share:
15,081

Related videos on Youtube

Alen
Author by

Alen

Updated on September 18, 2022

Comments

  • Alen
    Alen almost 2 years

    I'm using Ubuntu 16.04 and recently my database stopped working (don't know why, maybe after an update). When I tried to reinstall mysql-server-5.7 it returned errors on install so I purged everything and switched to mysql-server-5.6, this version installs but it won't run. This is the output:

    mysql.service - LSB: Start and stop the mysql database server daemon
       Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Čet 2017-02-02 10:00:15 CET; 8s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 9225 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
     Main PID: 12545 (code=exited, status=1/FAILURE)
    
    Feb 02 09:59:44 alen-Aspire-E1-570G systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
    Feb 02 09:59:44 alen-Aspire-E1-570G mysql[9225]:  * Starting MySQL database server mysqld
    Feb 02 09:59:44 alen-Aspire-E1-570G su[9259]: Successful su for mysql by root
    Feb 02 09:59:44 alen-Aspire-E1-570G su[9259]: + ??? root:mysql
    Feb 02 09:59:44 alen-Aspire-E1-570G su[9259]: pam_unix(su:session): session opened for user mysql by (uid=0)
    Feb 02 10:00:15 alen-Aspire-E1-570G mysql[9225]:    ...fail!
    Feb 02 10:00:15 alen-Aspire-E1-570G systemd[1]: mysql.service: Control process exited, code=exited status=1
    Feb 02 10:00:15 alen-Aspire-E1-570G systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
    Feb 02 10:00:15 alen-Aspire-E1-570G systemd[1]: mysql.service: Unit entered failed state.
    Feb 02 10:00:15 alen-Aspire-E1-570G systemd[1]: mysql.service: Failed with result 'exit-code'.
    

    I hope someone will be able to help me since I'm out of ideas. EDIT: Mysql error log: http://pastebin.com/tuMj1AA7

    • Khaled
      Khaled over 7 years
      Any relevant error in system log /var/log/syslog or mysql log?
    • Alen
      Alen over 7 years
      @Khaled I updated my question with mysql error log. I see "mariadb" is mentioned in that log, I was trying to install mariadb several day before, but that failed too.
  • coanor
    coanor almost 5 years
    when your ubuntu-desktop docker can not start mysql container, this may help you, just do the first step!