By foxywd
I’ve been trying to install MySQL 5.7 on my Ubuntu 20.04 Droplet and I get an error when launching mysql community server and I get stucked there.
These are the steps I followed:
As my current mysql installation has not previews packages I did:
service mysql stop sudo apt-get remove --purge mysql* sudo apt-get purge mysql* sudo apt autoremove && sudo apt autoclean sudo apt-get remove dbconfig-mysql sudo apt-get dist-upgrade cd /tmp curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb Select my desired version and Enable Previews Packages
Start Installation
sudo apt-get update sudo apt-cache policy mysql-server sudo apt install -f mysql-client=5.7.32-1ubuntu18.04 mysql-community-server=5.7.32-1ubuntu18.04 mysql-server=5.7.32-1ubuntu18.04 And then something fails and it cannot start the server:
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libmecab2 libtinfo5 mysql-common mysql-community-client The following NEW packages will be installed: libmecab2 libtinfo5 mysql-client mysql-common mysql-community-client mysql-community-server mysql-server 0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded. Need to get 51.2 MB of archives. After this operation, 315 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.digitalocean.com/ubuntu focal/main amd64 mysql-common all 5.8+1.0.5ubuntu2 [7496 B] Get:2 http://mirrors.digitalocean.com/ubuntu focal/universe amd64 libtinfo5 amd64 6.2-0ubuntu2 [83.0 kB] Get:3 http://mirrors.digitalocean.com/ubuntu focal/main amd64 libmecab2 amd64 0.996-10build1 [233 kB] Get:4 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 mysql-community-client amd64 5.7.32-1ubuntu18.04 [14.4 MB] Get:5 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 mysql-client amd64 5.7.32-1ubuntu18.04 [67.2 kB] Get:6 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 mysql-community-server amd64 5.7.32-1ubuntu18.04 [36.4 MB] Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 mysql-server amd64 5.7.32-1ubuntu18.04 [67.2 kB] Fetched 51.2 MB in 5s (10.5 MB/s) Preconfiguring packages ... Selecting previously unselected package mysql-common. (Reading database ... 120955 files and directories currently installed.) Preparing to unpack .../0-mysql-common_5.8+1.0.5ubuntu2_all.deb ... Unpacking mysql-common (5.8+1.0.5ubuntu2) ... Selecting previously unselected package libtinfo5:amd64. Preparing to unpack .../1-libtinfo5_6.2-0ubuntu2_amd64.deb ... Unpacking libtinfo5:amd64 (6.2-0ubuntu2) ... Selecting previously unselected package mysql-community-client. Preparing to unpack .../2-mysql-community-client_5.7.32-1ubuntu18.04_amd64.deb ... Unpacking mysql-community-client (5.7.32-1ubuntu18.04) ... Selecting previously unselected package mysql-client. Preparing to unpack .../3-mysql-client_5.7.32-1ubuntu18.04_amd64.deb ... Unpacking mysql-client (5.7.32-1ubuntu18.04) ... Selecting previously unselected package libmecab2:amd64. Preparing to unpack .../4-libmecab2_0.996-10build1_amd64.deb ... Unpacking libmecab2:amd64 (0.996-10build1) ... Selecting previously unselected package mysql-community-server. Preparing to unpack .../5-mysql-community-server_5.7.32-1ubuntu18.04_amd64.deb ... Unpacking mysql-community-server (5.7.32-1ubuntu18.04) ... Selecting previously unselected package mysql-server. Preparing to unpack .../6-mysql-server_5.7.32-1ubuntu18.04_amd64.deb ... Unpacking mysql-server (5.7.32-1ubuntu18.04) ... Setting up libmecab2:amd64 (0.996-10build1) ... Setting up mysql-common (5.8+1.0.5ubuntu2) ... update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode Setting up libtinfo5:amd64 (6.2-0ubuntu2) ... Setting up mysql-community-client (5.7.32-1ubuntu18.04) ... Setting up mysql-client (5.7.32-1ubuntu18.04) ... Setting up mysql-community-server (5.7.32-1ubuntu18.04) ... update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode 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 Wed 2020-11-25 06:24:48 -05; 8ms ago Process: 15083 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Process: 15132 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE) Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: mysql.service: Failed with result 'exit-code'. Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: Failed to start MySQL Community Server. Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 1. Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: Stopped MySQL Community Server. Nov 25 06:24:48 FoxyWD-VPS-2 systemd[1]: Starting MySQL Community Server... 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.32-1ubuntu18.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.3) ... No apport report written because the error message indicates its a followup error from a previous failure. Processing triggers for man-db (2.9.1-1) ... Processing triggers for libc-bin (2.31-0ubuntu9.1) ... Errors were encountered while processing: mysql-community-server mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) Any help on how to downgrade my mysql?
Thanks
Carlos C.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I followed the other answers here to do a complete purge of MySQL 8.0 and then followed another tutorial to install MySQL 5.7:
$ cd /tmp/ $ wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb $ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb (Select Ubuntu Bionic and then change 8.0 to 5.7)
$ sudo apt-get update $ sudo apt-cache policy mysql-server $ sudo apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7* $ sudo mysql_secure_installation One thing that is missing is that you need to “pin” the Ubuntu package manager to MySQL 5.7 otherwise it will try re-install MySQL 8.0 every time you run sudo apt-get dist-upgrade !
sudo vi /etc/apt/preferences.d/mysql
Package: mysql-server Pin: version 5.7* Pin-Priority: 1001 Package: mysql-client Pin: version 5.7* Pin-Priority: 1001 Package: mysql-community-server Pin: version 5.7* Pin-Priority: 1001 Package: mysql-community-client Pin: version 5.7* Pin-Priority: 1001 Package: libmysqlclient-dev Pin: version 5.7* Pin-Priority: 1001 See: https://askubuntu.com/questions/1313532/ubuntu-server-20-04-2-how-to-hold-mysql-to-5-7
Hi @foxywd,
Before you begin, I urge you to do a snapshot of your droplet just in ace.
First, you need to uninstall anything that is related to MySQL:
sudo apt-get purge mysql* sudo apt-get autoremove sudo apt-get autoclean Then the important bit, this error could be caused because your distribution is not upgraded recently, or at least conflicts are not resolved properly. So next thing is to upgrade it like this:
sudo apt-get dist-upgrade Now after this is done, you can try to install mysql as normal again.
Another solution would be to see if any leftovers are there
sudo rm -rf /etc/mysql sudo rm -rf /var/lib/mysql* Once you remove them you should be able to install MySQL. Please note that removing these folders will mean losing your old configuration files.
Regards, KFSys
For anyone who now attempts to use this article (for Ubuntu 20.04) you need to change the version from 5.7.32 to instead be 5.7.33
sudo apt install -f mysql-client=5.7.33-1ubuntu18.04 mysql-community-server=5.7.33-1ubuntu18.04 mysql-server=5.7.33-1ubuntu18.04 Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.