Ubuntu 20.04 can't start mysql server

7,081

Why not try to find out why it is not running, check those logs as the error states:

sudo systemctl status mysql.service
sudo journalctl -xe
Share:
7,081

Related videos on Youtube

topche
Author by

topche

Updated on September 18, 2022

Comments

  • topche
    topche over 1 year

    I did release-upgrade and after this upgrade I have problems with my mysql server. My server looks on place and it is running, but actually is not:

    systemctl status mysql.service
    
    ● mysql.service - MySQL Community Server
         Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
         Active: activating (start) since Wed 2020-07-01 14:01:37 EEST; 377ms ago
         Process: 4546 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
        Main PID: 4554 (mysqld)
        Status: "Server startup in progress"
        Tasks: 1 (limit: 6840)
        Memory: 125.5M
        CGroup: /system.slice/mysql.service
             └─4554 /usr/sbin/mysqld
    
    Jul 01 14:01:37 microserver systemd[1]: Starting MySQL Community Server...
    

    After running following command:

    netstat -an|grep LIST|grep 3306 
    

    nothing listen here.

    cat /etc/mysql/my.cnf 
    [mysqld]
    

    * Basic Settings

    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    lc-messages-dir = /usr/share/mysql
    skip-external-locking
    

    When I try to start mysql server I have this error:

    root@microserver:~# service mysql start
    Job for mysql.service failed because the control process exited with error code.
    See "systemctl status mysql.service" and "journalctl -xe" for details.
    
    ps ax|grep mysql
    9716 ?        Ssl    0:01 /usr/sbin/mysqld
    9744 pts/0    S+     0:00 grep --color=auto mysql
    

    When I try to connect:

    ps ax|grep mysql
    9716 ?        Ssl    0:01 /usr/sbin/mysqld
    9744 pts/0    S+     0:00 grep --color=auto mysql
    

    I did pure uninstallation and clearing everything and install again and still can't run the service.

    • Admin
      Admin about 2 years
      looks like AppArmor might be blocking the startup. I got a similar error when I checked sudo journalctl -xe got AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/run/mysqld/mysqlx.sock.lock" pid=XXXX comm="mysqld"...
  • Brunis
    Brunis over 2 years
    Those are as useful as Microsoft error codes
  • Admin
    Admin almost 2 years
    I had a similar issue, found out by running journalctl -xe that AppArmor was blocking the process from starting