4

I am trying to install MySQL 8.0 in Ubuntu 20.04 with sudo apt install mysql-server, but this error keeps showing up after reinstalling and after using sudo dpkg --configure -a :

Setting up mysql-server-8.0 (8.0.25-0ubuntu0.20.04.1) ...
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 191: /usr/share/mysql-common/
configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned
 error exit status 127
No apport report written because the error message indicates its a followup error from a previous failure.
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

I completely uninstalled MySQL and reinstalled it multiple times with sudo apt remove --purge --autoremove mysql-server, but the error persists.

3 Answers 3

21

I got the same problem and just found nice article to solve it.

Indeed deleting files directly from your MySQL folder is really not recommended. You can take a look at this guide here on how to delete old MySQL binary files here.

Regarding your current issue. In order to completely get rid of your MySQL installation you could run the following:

  1. Make sure MySQL is not running:

    sudo systemctl stop mysql
    
  2. Then purge all the MySQL packages:

    sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
    
  3. Then delete all the MySQL files:

    sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
    
  4. Finally clean all packages that are not needed:

    sudo apt autoremove
    sudo apt autoclean
    

Hope that this helps!

2
  • Thanks! That worked on Kubuntu jammy 22.04 LTS right now. Jul 18, 2022 at 2:00
  • It worked perfectly on Ubuntu Server 22.10, maybe should be chosen as the correct answer!!!! Oct 27, 2022 at 14:32
3

I had this problem trying to install mysql-server on a standard Digital Ocean droplet. The problem turned out to be that by default the droplet doesn't have enough memory to run mysql-8.0. There are probably other ways to solve it but I did it by adding a swap partition.

dd if=/dev/zero of=/swapfile bs=1M count=2048 

(creates a 2G swapfile, use a different count for different size)

chmod 600 /swapfile
mkswap /swapfile

Edit /etc/fstab: and add

/swapfile       none    swap    sw       0 0

(save and exit)

swapon /swapfile
swapon -s # make sure it works

Then reinstall mysql-server

2
  • You are the good.. I had the same issue with DO cheapest droplet.. You helped me a lot.. Thank dude
    – Vetalll
    Jul 29 at 14:30
  • Fixed it for me - same problem with fresh AWS EC2 nano instance! Aug 8 at 16:57
1

Stop the Mysql if it is running

sudo systemctl stop mysql.service
sudo kill $(pgrep mysql)

Then purge everything , this will also remove Mysql-workbench

sudo apt-get remove --purge mysql-\* 

Then reinstall mysql-server and mysql-client

sudo apt-get install mysql-server mysql-client

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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