Categories: Mysql

Reinstall MySQL on Ubuntu on a broken previous installation

Scenario:

Mysql was removed by a user without knowing what he was doing. He tried to install it again and not sure what all steps he followed.

If you try to install you will face below problem

  1. you cannot set MySQL root password
  2. MySQL will not be started after installation
  3. you will see MySQL dependencies errors

When I tried to install the packages I got below error message.

MySQL: Can’t create/write to file ‘/tmp********************

dpkg: error processing package mysql-server-5.5 (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.

start: Job failed to start
invoke-rc.d: initscript mysql, action “start” failed.
dpkg: error processing package mysql-server-5.5 (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (–configure):
dependency problems – leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.5
mysql-server

Solution

1)  Make sure /tmp folder has correct permission (1777 )

2) Remove MySQL and clean up folders

sudo apt-get remove –purge mysql-server mysql-client mysql-common mysql-server-5.5 mysql-client-5.5 mysql-server-core-5.5 mysql-client-core-5.5
sudo apt-get autoremove
sudo apt-get autoclean`
sudo rm -rf /var/lib/mysql /etc/mysql  ( you should take a copy of this folder if you have any database on the server )
sudo deluser mysql

3) Install MySQL Now

sudo apt-get install mysql-server-5.5
sudo apt-get install mysql-server

Hosting Ahead

Share
Published by
Hosting Ahead
Tags: mysql

Recent Posts

Run composer with different PHP version

If multiple PHP versions are installed on your server you need to tell the composer…

2 years ago

How to Install WordPress using WordPress Toolkit in cPanel

Wordpress toolkit allows the installation, configuration, and management of Wordpress. The first step is to…

3 years ago

Configure OpenVPN Client Devices for Andriod

These instructions cover installing and configuring the OpenVPN Connect app  Client-Side Configurations: Android There are…

3 years ago

The certificate chain was issued by an authority that is not trusted | SQL Server

This error may appear when you try to connect to Microsft SQL server or you…

4 years ago

Free website hosting support in this COVID pandemic

Hello everyone, The COVID-19 should have affected almost everyone in a way or another. When…

4 years ago

Amazon workspaces to build a secure work from home cloud infrastructure

Based on the current Covid19 scenario, several companies asked employees to work from home. Google…

4 years ago