Ubuntu – Ubuntu 16.04 LAMP MySQL dpkg install problems

dpkglampmariadbMySQLpackage-management

LAMP Ubuntu 16.04 MySQL server install problems

tried to set up LAMP system on Ubuntu 16.04 with the following instructions.
howtoforge
ubuntu_lamp_for_newbies
Apache and PHP installed and tested good.
MariaDB loaded and tested good, but could not get phpMyAdmin to work.

tried following LAMP installation instructions:
digitalocean
how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

tried removing and reloading.
How install or uninstall half-installed mysql-client-5.6 on/from ubuntu 15.10?
How install or uninstall half-installed mysql-client-5.6 on/from ubuntu 15.10?

 Richard Uijen has suggested: ( changed for server 5.7)

sudo apt-get --purge remove mysql*
sudo apt-get autoremove mysql*
sudo rm -rf /etc/mysql/
sudo rm -rf /var/lib/mysql/
sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall mysql-server-5.7

Had package installation error ( messed up other package installs as well ), reported bug got previous issue reply with conflict be MySQL install and previous MariaDB install.
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071
MySQL 5.6 refuses to install on systems that have had MariaDB 10.0 installed, preventing users from reverting to MySQL without manual
intervention (aka mysql flag file system needs a redesign)

tried removing any references to both. (mariadb* and mysql* ) solved package error.

Tried reinstalling MySQL:

sudo apt-get install mysql-server

mysql-server is already the newest version (5.7.12-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 2
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

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.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

current status:

mysql -u root -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

:systemctl status mysql.service
  mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Tue 2016-05-24 07:12:23 CDT; 2h 45min ago

 systemd[1]: Failed to start MySQL Community Server.

/etc/mysql does not exist.

At a loss now?

Best Answer

I had this exact issue. Look in your /etc/mysql/ directory for a file with a "deb10flag" in the filename. (I can't remember exactly what the file was named when I did this as it was a month ago.) I resolved it by removing the file with the debian10flag. This setting generated by the MariaDB installation (it sets the deb flag to version 10). I deleted /etc/mysql/ and cleaned out any trace of it from the bin. After doing all of that, there's a dependency issue with the mysql setup in the package repository. mysql-cli and mysql-server both depend on mysql-common. This is fixed (I think) by installing them in this order: (1) mysql-common, (2) mysql-cli, (3) mysql-server.

**I know this isn't clear. I'll reply with the exact steps that I used to fix this (soon). But the issue concerns the deb10flag and the dependency issues.

https://askubuntu.com/a/766094/407584Same issue

Related Question