1

Trying to install mysql, I always get the following error:

Errors were encountered while processing: /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

See in full below:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/3,184 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 283762 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried this solution as well as almost every solution available on stackoverflow but it doesn't solve my problem Even mysql server is not entirely removed by sudo apt-get remove --purge mysql-server. I've to remove it by using synaptic manager

What worked for me: Disabling all the third party repositories and the following the linked question instruction again

  • If you have really tried "every solution available on stackoverflow", then please edit your question to tell us exactly what you tried, and exactly what each result was. – user535733 Mar 06 '18 at 00:01

1 Answers1

0

The mysql service is allready running on your system. try

sudo service mysql stop

or read this: How do I start/stop mysql server?

after that, you should check which version of mysql is installed and see if you actually need a different version.