Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
I did a simple google search about the main error :
E: Sub-process /usr/bin/dpkg returned an error code (1)
I did came across this problem too one time like that and the way i solved it is by removing all files and folders related to mysql using this command below which i got from the link below the commands and it did work for me. Try and lets see if it will work for you too…
This is why you shouldn’t install stuff like XAMPP or any of those other prepackaged stacks on Linux – they’re usually packaged poorly and confuse the package manager at best and screw up your entire system at worst. Just install and configure them separately, which is something you’ll have to do in real world situations anyway.
Hey, thanks for the reply. And I haven’t been able to solve this issue unfortunately.
I fired up a VM (same OS, ubuntu 18.04) and tried some steps to install it right there, same error.
XAMPP will conflict easy enough to answer on that. It installs MariaDB which is a fork of MySQL and it grabs the ports. The MySQL install in Ubuntu starts the server to run the configuration process and will never complete if it doesn’t run. It will not run if any other MariaDB/MySQL exists. So, short of the options are:
If you’re uncertain of which packages you have laying around back your data, wipe, and reload. Often this is the easiest thing to do with an Ubuntu machine and isn’t as laborious of a process as it would be in Windows or something else. YMMV with this, but at least you are sure then there are no dependency conflicts and you could spend a lot of time fixing that.
Manually uninstall the XAMPP package by running its uninstaller in the /opt folder. Make sure you uninstall mysql well, then have another go… You cannot have MariaDB and MySQL on the same computer (they’re the same program, using the same ports, and locking the same resources). Even though this package predominately resides in opt it places scripts and config all over the place. Clean up any of the mysql packages you tried to install, and then attempt to redo it. If this doesn’t work do #1 and stop wasting time. You could spend more time trying to figure it out, but it wouldn’t be worth it. XAMPP doesn’t install things the way that is standard to Ubuntu and this is what causes most of the problems – you essentially are troubleshooting the weirdness this package injects into your system.
You should normally install “LAMP” in ubuntu with, not using XAMPP:
Create a backup of all your data: mysqldump -u root -p --all-databases > ~/alldb.sql
Remove packages and purge configurationÂą sudo apt purge "mysql-server-*"
Reinstall the MySQL server: sudo apt install mysql-server , you should see Running queries to upgrade MySQL server. and it will show every table in your database
Thank you for the in depth explanation. However right now I have to pause all coding activities. And if I try out your solution later I will post my result/outcome here. Thanks.