Problems installing MySQL on Ubuntu 20.04

Viewed 9145

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.

2 Answers

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:

  • Make sure MySQL is not running:
sudo systemctl stop mysql
  • Then purge all of the MySQL packages:
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
  • Then delete all of the MySQL files:
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
  • Finally clean all packages that are not needed:
  • List item
sudo apt autoremove
sudo apt autoclean

Hope that this helps! Regards,

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
Related