user101529
user101529

Reputation: 23

Can't install mysql-server package

I am trying to install the mysql-server package on debian and I am getting an error:

t@mintserver:~$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/2.942 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 372098 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.29-0ubuntu0.18.04.1_all.deb ...
Unpacking mysql-server (5.7.29-0ubuntu0.18.04.1) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not installed.

I read many other replies that told me to purge the packages, correct dependencies, but nothing works.

t@mintserver:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2.933 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not installed.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Upvotes: 2

Views: 5031

Answers (1)

Ictus
Ictus

Reputation: 1567

Please, run sudo dpkg --audit or sudo dpkg -C, it's the same. It probably will suggest to you what to do.

Edit: According to your comment,

Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ... update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist dpkg: error processing package mysql-server-5.7 (--configure): installed mysql-server-5.7 package post-installation script subprocess returned error exit status 2 Errors were encountered while processing: mysql-server-5.7

the update-alternatives program failed to find this mysql.cnf file.

Could you try creating that file? Please, do: sudo nano /etc/mysql/mysql.cnf filling with this content:

[mysql]

Then, try again dpkg --configure <package>

Or, this will probably do the job:

sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client

If interested, you could also read A Quick Guide to Using the MySQL APT Repository. They provide different installation approaches for different scenarios.

Upvotes: 1

Related Questions