Question

Unable to install mysql-server on Ubuntu

Hello All,

I’m following the LAMP tutorial (https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-22-04), but I don’t seem to be able to install MySQL on Ubuntu 22.04 . I tried deleting my droplet, making a new one, and installing MySQL before anything else, but I still get the following after running “sudo apt install mysql-server”:

mysqld will log errors to /var/log/mysql/error.log
2022-07-11T19:20:59.707275Z 0 [ERROR] [MY-011065] [Server] Unable to determine if daemon is running: Invalid argument (rc=0).
2022-07-11T19:20:59.708151Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed.
See "systemctl status mysql.service" and "journalctl -xeu mysql.service" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: oom-kill) since Mon 2022-07-11 19:21:04 UTC; 36ms ago
    Process: 2778 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 2786 ExecStart=/usr/sbin/mysqld (code=killed, signal=KILL)
   Main PID: 2786 (code=killed, signal=KILL)
     Status: "Server startup in progress"
        CPU: 1.229s
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libcgi-pm-perl (4.54-1) ...
Setting up libhtml-template-perl (2.97-1.1) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up libcgi-fast-perl (1:2.15-1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                          Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks in advance for any advice


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

I’ve just worked out it was due to a lack of memory on the Droplet, I upgraded from 512MB to 1GB , and it now installs fine

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @andrewmercel,

Before installing the MySQL instance have you install all the updates on your Droplet? I just created a droplet and it worked:

  1. apt update
  2. apt upgrade
  3. apt install mysql-server