1

I want to reinstall mysql in Ubuntu 16.04.

mysql-server is already the newest version (5.7.21-0ubuntu0.16.04.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

After this I wrote a code for removing mysql, but it's not being removed.

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'mysql-server-core-5.1' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.5' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.6' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.7' for glob 'mysql-server-core-*'
Package 'mysql-server-core-5.6' is not installed, so not removed
Package 'mysql-server-core-5.5' is not installed, so not removed
Package 'mysql-server-core-5.1' is not installed, so not removed
Note, selecting 'mysql-client-core-5.5' for glob 'mysql-client-core-*'
Note, selecting 'mysql-client-core-5.6' for glob 'mysql-client-core-*'
Note, selecting 'mysql-client-core-5.7' for glob 'mysql-client-core-*'
Package 'mysql-client-core-5.5' is not installed, so not removed
Package 'mysql-client-core-5.6' is not installed, so not removed
Package 'mysql-client' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libmysqlclient20 : Depends: mysql-common (>= 5.5) but it is not going to be installed
 mariadb-common : Depends: mysql-common (>= 5.6.25) but it is not going to be installed
 mysql-client-5.7 : Depends: mysql-client-core-5.7 but it is not going to be installed
                    Depends: mysql-common (>= 5.5) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
karel
  • 110,292
  • 102
  • 269
  • 299
  • 1
    Please add what the first command you ran is. – fosslinux Apr 05 '18 at 03:42
  • Have you tried its suggestion `sudo apt -f install`? – NerdOfCode Apr 05 '18 at 03:57
  • 1
    This sounds like an [X-Y Problem](//meta.stackexchange.com/q/66377/271411). What are you actually trying to achieve? – David Foerster Apr 05 '18 at 09:02
  • Possible duplicate of [Can I uninstall and reinstall Ubuntu Software Center?](https://askubuntu.com/questions/133456/can-i-uninstall-and-reinstall-ubuntu-software-center) Specifically I think you need to use [this answer](https://askubuntu.com/a/171247/225694) on the package in question. – Elder Geek Apr 08 '18 at 12:30

1 Answers1

0

You can try these steps:

  1. This removes mysql-server from your System.

    apt-get autoremove mysql-server
    
  2. Check if you still have mysql installed.

    mysql -V
    
  3. This installs mysql-server

    apt-get install mysql-server
    

If you are still having having issues start with

apt-get install -f

If it still does not work try:

dpkg-reconfigure mysql-server
David Foerster
  • 35,754
  • 55
  • 92
  • 145
Krishna Chalise
  • 170
  • 2
  • 4
  • 17