0

I'm following this link to install MYSQL-5.7 on Ubuntu-20.04LTS.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

$ sudo apt-cache policy mysql-server
mysql-server:
  Installed: (none)
  Candidate: 8.0.27-0ubuntu0.20.04.1
  Version table:
     8.0.27-0ubuntu0.20.04.1 500
        500 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://br.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
     8.0.19-0ubuntu5 500
        500 http://br.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://br.archive.ubuntu.com/ubuntu focal/main i386 Packages
     5.7.34-1ubuntu16.04 500
        500 http://repo.mysql.com/apt/ubuntu xenial/mysql-5.7 amd64 Packages

Source.list taken from this GitHubLink Still it is referring 5.7.34-1ubuntu16.04 tried to install sudo apt install -f mysql-client=5.7.34-1ubuntu16.04 installed successfully, But server package installation always fails with below errors.

sudo apt install -f mysql-server=5.7.34-1ubuntu16.04
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2021-11-14 16:55:53 IST; 11ms ago
    Process: 17911 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 17962 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.34-1ubuntu16.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-11-14 16:55:59 IST; 5min ago
    Process: 18737 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 18789 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)

Executed below commands,But couldn't help, it results the same.

$ sudo dpkg --configure -a
$ sudo apt install --fix-broken
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.34-1ubuntu16.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo ls /var/cache/apt/archives/
libicu60_60.2-3ubuntu3.2_amd64.deb          mysql-community-server_5.7.36-1ubuntu18.04_amd64.deb  vim_2%3a8.1.2269-1ubuntu5.4_amd64.deb
libopenexr22_2.2.0-11.1ubuntu1.8_amd64.deb  mysql-community-source_5.7.36-1ubuntu18.04_amd64.deb  vim-common_2%3a8.1.2269-1ubuntu5.4_all.deb
lock                                        mysql-server_5.7.36-1ubuntu18.04_amd64.deb            vim-runtime_2%3a8.1.2269-1ubuntu5.4_all.deb
mysql-apt-config_0.8.16-1_all.deb           partial                                               xxd_2%3a8.1.2269-1ubuntu5.4_amd64.deb

How do i fix these errors and install Mysql-5.7 now?

10
  • From the looks of it, you're trying to install a version of MySQL that is expecting Ubuntu 16.04-specific packages and versions of dependencies. This isn't going to work very reliably on 20.04. If you absolutely need MySQL 5.7, I would strongly suggest using a Docker container. This will allow you to have a 5.7 installation that does not fall victim to an accidental upgrade (to 8.0) and will allow you to easily move the container between hosts (if such a thing is required during an upgrade, etc.)
    – matigo
    Nov 14, 2021 at 11:37
  • @matigo, Yes by-default it is being fetching 5.7.34-1ubuntu16.04 500 instead of MYSQL5.7 of Ubuntu-18.04. Now how do i get the 5.7.xubuntu18.04 if i run sudo apt-cache policy mysql-server ? Please assist. Nov 14, 2021 at 11:42
  • Perhaps this answer from last year will help you. I do not know if it's still valid, though, as I've not worked with MySQL 5.7 on a bare metal installation since 18.04. Docker containers have generally offered me a more reliable, more predicable database engine when working with older versions 🤐
    – matigo
    Nov 14, 2021 at 11:44
  • 1
    @matigo, I tried a lot with above shared link instructions, But unfortunately couldn't succeeded, Therefore pulled a docker image and restored the DB in thatn Now working as excepted. Thanks a lot for your assistance. Nov 15, 2021 at 2:31
  • Ok , So I found the solution ! But for you need to edit the question and add the output of ls /var/cache/apt/archives/
    – Error404
    Nov 16, 2021 at 10:32

0

You must log in to answer this question.

Browse other questions tagged .