mySQL server refused to be installed on Ubuntu 18.04

Guys sorry for the harsh tone I am just simply want to solve this issue asap.

steps I took:

sudo apt-get update
sudo apt-get install mysql-server

errors I got :

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)

web site I went to : [Solved] “sub process usr bin dpkg returned an error code 1″

it tells me there are a few ways to do a work around :

I tried them all but they all did not work.

On stackoverflow I saw this so I gave it a try: mysql-server-5.7 is not configured yet - Stack Overflow

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server


sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install


sudo apt install mysql-server

Still gives me the same error.

What steps should I take now.

is it because I installed XAMPP before SQL server???

also another thing is I am doing all these because I got this error when trying to setup OctoberCMS:

yes it does… but it keeps giving me the error above…
so I thought it was bceasue I did not install mySQL server + mySQL client on my machine…

Welcome to the world of Linux lol. Best thing to do if it doesn’t work try finding an alternative :3

1 Like

Gavin Belson: “Fuck!”

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…

sudo apt-get  **remove**  -- **purge mysql** *
sudo apt-get  **purge mysql** *
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get  **remove**  dbconfig- **mysql** 
sudo apt-get dist-upgrade
sudo apt-get  **install mysql** - **server** 

this is the link that helped me out…

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.

hmmm lesson learnt… =.=

@chuckadams @charmming

I will set up a VM and try install in it see how it goes.

Have you resolve this problem? What is your operating system? I installed XAMP linux on my linux mint machine and it works with no problem.

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.

may I know that what is the version of your linux machine?

I use Centos7.

It’s very easy to install.

https://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/

Keep in mind this installs MySQL 8.

Also if you decide to go with fedora, dnf install @mysql works too.

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:

  1. 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.

  2. 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:

sudo apt-get install tasksel
sudo tasksel install lamp-server

That will install apache2, mysql, php, and all dependencies and configure them to be ready to use in the way that is standard to Ubuntu.

1 Like

Hi @zhouxiang19910319

try this may be it will help for ubantu 18.04

1

I had the same problem.

I solved it by purging the configuration.

  1. Create a backup of all your data: mysqldump -u root -p --all-databases > ~/alldb.sql
  2. Remove packages and purge configurationÂą sudo apt purge "mysql-server-*"
  3. 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.