I cannot install mysql on ubuntu 18.04 - mysql

I am trying to install mysql-server on my ubuntu 18.04 ,but I am getting the dpkg error
The terminal output after sudo apt-get install mysql-server is
Reading package lists... Done Building dependency tree Reading
state information... Done The following additional packages will be
installed: libaio1 libevent-core-2.1-6 mysql-client-5.7
mysql-client-core-5.7 mysql-common mysql-server-5.7
mysql-server-core-5.7 Suggested packages: mailx tinyca The following
NEW packages will be installed: libaio1 libevent-core-2.1-6
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server
mysql-server-5.7 mysql-server-core-5.7 0 upgraded, 8 newly installed,
0 to remove and 0 not upgraded. Need to get 0 B/19.1 MB of archives.
After this operation, 155 MB of additional disk space will be used. Do
you want to continue? [Y/n] Y Preconfiguring packages ... Selecting
previously unselected package mysql-common. (Reading database ...
274343 files and directories currently installed.) Preparing to unpack
.../0-mysql-common_1%3a10.4.12+maria~eoan_all.deb ... Unpacking
mysql-common (1:10.4.12+maria~eoan) ... Selecting previously
unselected package libaio1:amd64. Preparing to unpack
.../1-libaio1_0.3.110-5ubuntu0.1_amd64.deb ... Unpacking libaio1:amd64
(0.3.110-5ubuntu0.1) ... Selecting previously unselected package
mysql-client-core-5.7. Preparing to unpack
.../2-mysql-client-core-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-client-5.7. Preparing to
unpack .../3-mysql-client-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.29-0ubuntu0.18.04.1) ... Selecting
previously unselected package mysql-server-core-5.7. Preparing to
unpack .../4-mysql-server-core-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb
... Unpacking mysql-server-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Selecting previously unselected package libevent-core-2.1-6:amd64.
Preparing to unpack
.../5-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb ... Unpacking
libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ... Setting up
mysql-common (1:10.4.12+maria~eoan) ... Selecting previously
unselected package mysql-server-5.7. (Reading database ... 274503
files and directories currently installed.) Preparing to unpack
.../mysql-server-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ... Unpacking
mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ... Selecting previously
unselected package mysql-server. Preparing to unpack
.../mysql-server_5.7.29-0ubuntu0.18.04.1_all.deb ... Unpacking
mysql-server (5.7.29-0ubuntu0.18.04.1) ... Setting up
libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ... Setting up
libaio1:amd64 (0.3.110-5ubuntu0.1) ... Setting up
mysql-client-core-5.7 (5.7.29-0ubuntu0.18.04.1) ... Setting up
mysql-server-core-5.7 (5.7.29-0ubuntu0.18.04.1) ... Setting up
mysql-client-5.7 (5.7.29-0ubuntu0.18.04.1) ... Setting up
mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191:
/usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess
returned error exit status 127 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.
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) ... ureadahead will be reprofiled
on next reboot Errors were encountered while processing:
mysql-server-5.7 mysql-server E: Sub-process /usr/bin/dpkg returned
an error code (1)
I have tried every other solution that I could find on stack overflow and elsewhere on the Internet.
The solutions that i have tried include purging mysql,autoremove,autoclean,dist upgrade,reboot,removing /etc/mysql /var/lib/mysql and almost every other thing that I could find related to this problem.It is not helping me, and now asking this question because no other answers were helping me.I am not worried of losing any DB that I might I have on my system.
I must add that since installing mysql was not working for me,I went with mongodb.It installed fine initally ,but now even removing and installing mongodb is givinf the same Error.

please try the following steps,
1.) First, update the apt package index by typing:
$sudo apt update
2.)Then install the MySQL package with the following command:
$sudo apt install mysql-server
3.)Once the installation is completed, the MySQL service will start automatically. To check whether the MySQL server is running, type:
$sudo systemctl status mysql
output
●
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-2-20 11:30:23 PDT; 5min ago
Main PID: 17382 (mysqld)
Tasks: 27 (limit: 2321)
CGroup: /system.slice/mysql.service
`-17382 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Related

How to prevent MariaDB to install when installing MySQL-Server?

I am trying to install MySQL Server in a Debian 9 installation and apt-get insists to install this mariadb-client-10.1 through:
sudo apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libmecab2 libtext-template-perl mecab-ipadic mecab-ipadic-utf8 mecab-utils
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
default-mysql-client default-mysql-server mariadb-client-10.1
mariadb-server-10.1
Suggested packages:
mailx mariadb-test netcat-openbsd tinyca
The following NEW packages will be installed:
default-mysql-client default-mysql-server mariadb-client-10.1
mariadb-server-10.1 mysql-client mysql-server
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,748 B/11.2 MB of archives.
After this operation, 125 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.jaist.ac.jp/debian stretch/main amd64 default-mysql- client all 1.0.2 [3,050 B]
Get:2 http://ftp.jaist.ac.jp/debian stretch/main amd64 mysql-client amd64 5.5.9999+default [1,698 B]
Fetched 4,748 B in 0s (92.8 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mariadb-client-10.1.
(Reading database ... 290851 files and directories currently installed.)
Preparing to unpack .../0-mariadb-client-10.1_10.1.26-0+deb9u1_amd64.deb ...
Unpacking mariadb-client-10.1 (10.1.26-0+deb9u1) ...
Selecting previously unselected package mariadb-server-10.1.
Preparing to unpack .../1-mariadb-server-10.1_10.1.26-0+deb9u1_amd64.deb ...
Unpacking mariadb-server-10.1 (10.1.26-0+deb9u1) ...
Selecting previously unselected package default-mysql-client.
Preparing to unpack .../2-default-mysql-client_1.0.2_all.deb ...
Unpacking default-mysql-client (1.0.2) ...
Selecting previously unselected package default-mysql-server.
Preparing to unpack .../3-default-mysql-server_1.0.2_all.deb ...
Unpacking default-mysql-server (1.0.2) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../4-mysql-client_5.5.9999+default_amd64.deb ...
Unpacking mysql-client (5.5.9999+default) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../5-mysql-server_5.5.9999+default_amd64.deb ...
Unpacking mysql-server (5.5.9999+default) ...
Setting up mariadb-client-10.1 (10.1.26-0+deb9u1) ...
Processing triggers for menu (2.1.47+b1) ...
Processing triggers for systemd (232-25+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up mariadb-server-10.1 (10.1.26-0+deb9u1) ...
Setting up default-mysql-client (1.0.2) ...
Setting up default-mysql-server (1.0.2) ...
Setting up mysql-server (5.5.9999+default) ...
Setting up mysql-client (5.5.9999+default) ...
Processing triggers for systemd (232-25+deb9u4) ...
Is there any way I can install only MySQL-server? Or that MariaDB thing must be installed? Thanks in advance.
you go to http://repo.mysql.com/ and choose a version
I have debian 9 so I choose
wget http://repo.mysql.com/mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Then you will be asked what you desire to install ... you say mysql Server
then you go as usual ...
sudo apt update
sudo apt install mysql-server
and the rest you know probably ...

MySQL 5.7 installation error `mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`

I am trying to install MySQL 5.7 on Ubuntu 14.04.
Following are the steps I followed:
rm -rf /var/lib/mysql
mkdir -p /var/lib/mysql
cd
wget http://dev.mysql.com/get/mysql-apt-config_0.7.2-1_all.deb
dpkg -i mysql-apt-config_0.7.2-1_all.deb
apt-get update
apt-get -y install mysql-server
All the steps run perfectly except for the last one. It gives me the following error:
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-05-10T02:10:24.219279Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-05-10T02:10:24.219530Z 0 [ERROR] Aborting
Following is the complete log of the error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apparmor libaio1 libapparmor-perl libapparmor1 libmecab2 mysql-client
mysql-common mysql-community-client mysql-community-server psmisc
Suggested packages:
apparmor-profiles apparmor-docs apparmor-utils
The following NEW packages will be installed:
apparmor libaio1 libapparmor-perl libapparmor1 libmecab2 mysql-client
mysql-common mysql-community-client mysql-community-server mysql-server
psmisc
0 upgraded, 11 newly installed, 0 to remove and 2 not upgraded.
Need to get 27.8 MB of archives.
After this operation, 215 MB of additional disk space will be used.
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-common amd64 5.7.12-1ubuntu14.04 [261 kB]
Get:2 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-client amd64 5.7.12-1ubuntu14.04 [7307 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6364 B]
Get:4 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-client amd64 5.7.12-1ubuntu14.04 [12.4 kB]
Get:5 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-server amd64 5.7.12-1ubuntu14.04 [19.5 MB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libapparmor1 amd64 2.8.95~2430-0ubuntu5.3 [25.5 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libapparmor-perl amd64 2.8.95~2430-0ubuntu5.3 [26.8 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty-updates/main apparmor amd64 2.8.95~2430-0ubuntu5.3 [319 kB]
Get:9 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-server amd64 5.7.12-1ubuntu14.04 [12.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ trusty/main psmisc amd64 22.20-1ubuntu2 [53.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ trusty/universe libmecab2 amd64 0.996-1.1 [244 kB]
Fetched 27.8 MB in 0s (35.1 MB/s)
Preconfiguring packages ...
Selecting previously unselected package libaio1:amd64.
(Reading database ... 21277 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-common (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../mysql-community-client_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-client (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../mysql-client_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-client (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package libapparmor1:amd64.
Preparing to unpack .../libapparmor1_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking libapparmor1:amd64 (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package libapparmor-perl.
Preparing to unpack .../libapparmor-perl_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking libapparmor-perl (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package apparmor.
Preparing to unpack .../apparmor_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking apparmor (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package psmisc.
Preparing to unpack .../psmisc_22.20-1ubuntu2_amd64.deb ...
Unpacking psmisc (22.20-1ubuntu2) ...
Selecting previously unselected package libmecab2.
Preparing to unpack .../libmecab2_0.996-1.1_amd64.deb ...
Unpacking libmecab2 (0.996-1.1) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../mysql-community-server_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-server (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-server (5.7.12-1ubuntu14.04) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up mysql-common (5.7.12-1ubuntu14.04) ...
Setting up mysql-community-client (5.7.12-1ubuntu14.04) ...
Setting up mysql-client (5.7.12-1ubuntu14.04) ...
Setting up libapparmor1:amd64 (2.8.95~2430-0ubuntu5.3) ...
Setting up libapparmor-perl (2.8.95~2430-0ubuntu5.3) ...
Setting up apparmor (2.8.95~2430-0ubuntu5.3) ...
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of reload.
Setting up psmisc (22.20-1ubuntu2) ...
Setting up libmecab2 (0.996-1.1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-community-server (5.7.12-1ubuntu14.04) ...
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-05-10T02:10:24.219279Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-05-10T02:10:24.219530Z 0 [ERROR] Aborting
dpkg: error processing package mysql-community-server (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.12-1ubuntu14.04); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mysql-community-server
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Can someone please suggest me a solution for the error?
Thanks in advance!
You need to make sure that your data directory is owned by the mysql user and belongs to the mysql group. I've forgotten to do this before as well when setting up MySQL. It should work if you do:
sudo chown mysql /var/lib/mysql
sudo chgrp mysql /var/lib/mysql
Here's the MySQL documentation.
Docker for Mac (native) makes this much easier than before, I had the permission issues using Toolbox.
https://docs.docker.com/docker-for-mac/

Installing MySQL-Service on Ubuntu

I just installed Ubuntu 15.04. Also installed xampp and now I am trying to install mysql-service to use the mysql commands (imports, exports etc). I ran this command sudo apt-get install mysql-service and I got this error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.6 mysql-common
mysql-server-5.6
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.6 mysql-common
mysql-server mysql-server-5.6
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11,6 MB of archives.
After this operation, 104 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 210291 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.6.28-0ubuntu0.15.10.1_all.deb ...
Unpacking mysql-common (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.6.28-0ubuntu0.15.10.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.028-2_amd64.deb ...
Unpacking libdbd-mysql-perl (4.028-2) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.28-0ubuntu0.15.10.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up mysql-common (5.6.28-0ubuntu0.15.10.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.6.
(Reading database ... 210386 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.28-0ubuntu0.15.10.1_amd64.deb ...
Unpacking mysql-server-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.6.28-0ubuntu0.15.10.1_all.deb ...
Unpacking mysql-server (5.6.28-0ubuntu0.15.10.1) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
Setting up libmysqlclient18:amd64 (5.6.28-0ubuntu0.15.10.1) ...
Setting up libdbd-mysql-perl (4.028-2) ...
Setting up mysql-client-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Setting up mysql-server-5.6 (5.6.28-0ubuntu0.15.10.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
2016-03-05 14:32:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-05 14:32:13 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-0ubuntu0.15.10.1) starting as process 8166 ...
Job for mysql.service failed because a timeout was exceeded. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--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.6; however:
Package mysql-server-5.6 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.21-0ubuntu4.1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
Errors were encountered while processing:
mysql-server-5.6
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
After that I run the command mysql and I got this message error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I tried a lot of other suggetions from stackoverflow and other forums, but none of them are working. Can you help me with this ? thx

Unable to install mysql server on Ubuntu 12.04

I have been unsuccessful at installing a mysql server on Ubuntu 12.04. Here is what I see when I try to install after a remove --purge of mysql server:
$ sudo apt-get install mysql-server-5.5 mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
tinyca mailx
The following NEW packages will be installed:
mysql-server mysql-server-5.5
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/8,861 kB of archives.
After this operation, 32.8 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 257077 files and directories currently installed.)
Unpacking mysql-server-5.5
(from .../mysql-server-5.5_5.5.43-0ubuntu0.12.04.1_amd64.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.43-0ubuntu0.12.04.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up mysql-server-5.5 (5.5.43-0ubuntu0.12.04.1) ...
150705 15:38:03 [Warning] Using unique option prefix key_buffer instead of
key_buffer_size is deprecated and will be removed in a future release.
Please use the full name instead.
150705 15:38:03 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.12.04.1)
starting as process 14658 ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
No apport report written because the error message indicates its a followup
error from a previous failure.
dpkg: error processing 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 mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
A mysql client is installed, but when I try to launch it I get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Any help will be appreciated.
Well, I got no help from StackExchange, so I dug deeper and figured it out myself: First I got rid of mysql-server and mysql-client by following instructions at Removing MySQL 5.5 Completely. Then I simply installed the server and client as usual with apt-get. Everything worked fine after that.

An issue installing MySQL 5.5 on clean Ubuntu 12.04.3 LTS

I am trying to install mysql-server and libmysqlclient-dev on clean Ubuntu 12.04.3 LTS, but I get an error:
131031 13:31:15 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
No apport report written because the error message indicates its a followup error from a previous failure.
ldconfig deferred processing now taking place
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Full traceback:
$ dpkg -S etc/mysql
mysql-common: /etc/mysql/my.cnf
mysql-server-5.5: /etc/mysql/debian-start
mysql-common, mysql-server-5.5: /etc/mysql/conf.d
mysql-server-5.5: /etc/mysql/conf.d/mysqld_safe_syslog.cnf
mysql-common, mysql-server-5.5: /etc/mysql
$ sudo apt-get purge mysql-server mysql-common
apt-get: /usr/local/lib/libz.so.1: no version information available (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libdbd-mysql-perl* libmysqlclient-dev* libmysqlclient18* mysql-client-5.5*
mysql-common* mysql-server* mysql-server-5.5*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 73.0 MB disk space will be freed.
Do you want to continue [Y/n]? yes
(Reading database ... 72906 files and directories currently installed.)
Removing mysql-server ...
Removing mysql-server-5.5 ...
Purging configuration files for mysql-server-5.5 ...
Removing mysql-client-5.5 ...
Removing libdbd-mysql-perl ...
Removing libmysqlclient-dev ...
Removing libmysqlclient18 ...
Purging configuration files for libmysqlclient18 ...
Removing mysql-common ...
Purging configuration files for mysql-common ...
dpkg: warning: while removing mysql-common, directory '/etc/mysql' not empty so not removed.
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
$ dpkg -S etc/mysql
dpkg-query: no path found matching pattern *etc/mysql*.
$ sudo dpkg -i mysql-5.6.14-debian6.0-x86_64.deb
(Reading database ... 72664 files and directories currently installed.)
Preparing to replace mysql 5.6.14 (using mysql-5.6.14-debian6.0-x86_64.deb) ...
Unpacking replacement mysql ...
Setting up mysql (5.6.14) ...
$ sudo apt-get install mysql-server
apt-get: /usr/local/lib/libz.so.1: no version information available (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common
mysql-server-5.5
Suggested packages:
tinyca mailx
Recommended packages:
libhtml-template-perl
The following NEW packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common
mysql-server mysql-server-5.5
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/18.2 MB of archives.
After this operation, 67.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
apt-extracttemplates: /usr/local/lib/libz.so.1: no version information available (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 72664 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.5.34-0ubuntu0.12.04.1_all.deb) ...
Selecting previously unselected package libmysqlclient18.
Unpacking libmysqlclient18 (from .../libmysqlclient18_5.5.34-0ubuntu0.12.04.1_amd64.deb) ...
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.020-1build2_amd64.deb) ...
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.34-0ubuntu0.12.04.1_amd64.deb) ...
Processing triggers for man-db ...
Setting up mysql-common (5.5.34-0ubuntu0.12.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 72750 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.34-0ubuntu0.12.04.1_amd64.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.34-0ubuntu0.12.04.1_all.deb) ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up libmysqlclient18 (5.5.34-0ubuntu0.12.04.1) ...
Setting up libdbd-mysql-perl (4.020-1build2) ...
Setting up mysql-client-5.5 (5.5.34-0ubuntu0.12.04.1) ...
Setting up mysql-server-5.5 (5.5.34-0ubuntu0.12.04.1) ...
131031 13:31:15 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
No apport report written because the error message indicates its a followup error from a previous failure.
ldconfig deferred processing now taking place
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Killing mysql processes and running
sudo apt-get install mysql-server --fix-missing --fix-broken
did the trick for me. Probably purge is needed before too, though.
https://serverfault.com/a/296928/124523