I'm trying to install MySQL using:
sudo apt install mysql-server
and I'm getting the following message at the end of the process:
E: Sub-process /usr/bin/dpkg returned an error code (1)
The whole input/output:
ubuntu@ubuntu:~$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm10 libllvm11 linux-headers-5.4.0-40
linux-headers-5.4.0-40-generic linux-headers-5.4.0-42
linux-headers-5.4.0-42-generic linux-headers-5.4.0-45
linux-headers-5.4.0-45-generic linux-headers-5.4.0-47
linux-headers-5.4.0-47-generic linux-headers-5.4.0-56
linux-headers-5.4.0-56-generic linux-headers-5.4.0-60
linux-headers-5.4.0-60-generic linux-headers-5.4.0-65
linux-headers-5.4.0-65-generic linux-headers-5.4.0-66
linux-headers-5.4.0-66-generic linux-headers-5.4.0-67
linux-headers-5.4.0-67-generic linux-headers-5.4.0-70
linux-headers-5.4.0-70-generic linux-headers-5.4.0-71
linux-headers-5.4.0-71-generic linux-headers-5.4.0-72
linux-headers-5.4.0-72-generic linux-headers-5.4.0-73
linux-headers-5.4.0-73-generic linux-headers-5.4.0-74
linux-headers-5.4.0-74-generic linux-headers-5.4.0-77
linux-headers-5.4.0-77-generic linux-headers-5.4.0-80
linux-headers-5.4.0-80-generic linux-image-5.4.0-40-generic
linux-image-5.4.0-42-generic linux-image-5.4.0-45-generic
linux-image-5.4.0-47-generic linux-image-5.4.0-56-generic
linux-image-5.4.0-60-generic linux-image-5.4.0-65-generic
linux-image-5.4.0-66-generic linux-image-5.4.0-67-generic
linux-image-5.4.0-70-generic linux-image-5.4.0-71-generic
linux-image-5.4.0-72-generic linux-image-5.4.0-73-generic
linux-image-5.4.0-74-generic linux-image-5.4.0-77-generic
linux-image-5.4.0-80-generic linux-modules-5.4.0-40-generic
linux-modules-5.4.0-42-generic linux-modules-5.4.0-45-generic
linux-modules-5.4.0-47-generic linux-modules-5.4.0-56-generic
linux-modules-5.4.0-60-generic linux-modules-5.4.0-65-generic
linux-modules-5.4.0-66-generic linux-modules-5.4.0-67-generic
linux-modules-5.4.0-70-generic linux-modules-5.4.0-71-generic
linux-modules-5.4.0-72-generic linux-modules-5.4.0-73-generic
linux-modules-5.4.0-74-generic linux-modules-5.4.0-77-generic
linux-modules-5.4.0-80-generic linux-modules-extra-5.4.0-40-generic
linux-modules-extra-5.4.0-42-generic linux-modules-extra-5.4.0-45-generic
linux-modules-extra-5.4.0-47-generic linux-modules-extra-5.4.0-56-generic
linux-modules-extra-5.4.0-60-generic linux-modules-extra-5.4.0-65-generic
linux-modules-extra-5.4.0-66-generic linux-modules-extra-5.4.0-67-generic
linux-modules-extra-5.4.0-70-generic linux-modules-extra-5.4.0-71-generic
linux-modules-extra-5.4.0-72-generic linux-modules-extra-5.4.0-73-generic
linux-modules-extra-5.4.0-74-generic linux-modules-extra-5.4.0-77-generic
linux-modules-extra-5.4.0-80-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libevent-pthreads-2.1-7 mysql-client-8.0 mysql-client-core-8.0
mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
libevent-pthreads-2.1-7 mysql-client-8.0 mysql-client-core-8.0 mysql-server
mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.1 MB of archives.
After this operation, 204 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.ubuntu.com/ubuntu focal-security/main amd64 mysql-client-core-8.0 amd64 8.0.26-0ubuntu0.20.04.2 [4222 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libevent-pthreads-2.1-7 amd64 2.1.11-stable-1 [7372 B]
Get:3 http://security.ubuntu.com/ubuntu focal-security/main amd64 mysql-client-8.0 amd64 8.0.26-0ubuntu0.20.04.2 [22.0 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/main amd64 mysql-server-core-8.0 amd64 8.0.26-0ubuntu0.20.04.2 [18.5 MB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 mysql-server-8.0 amd64 8.0.26-0ubuntu0.20.04.2 [1329 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 mysql-server all 8.0.26-0ubuntu0.20.04.2 [9540 B]
Fetched 24.1 MB in 5s (4936 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-client-core-8.0.
(Reading database ... 881128 files and directories currently installed.)
Preparing to unpack .../0-mysql-client-core-8.0_8.0.26-0ubuntu0.20.04.2_amd64.de
b ...
Unpacking mysql-client-core-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../1-mysql-client-8.0_8.0.26-0ubuntu0.20.04.2_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Selecting previously unselected package libevent-pthreads-2.1-7:amd64.
Preparing to unpack .../2-libevent-pthreads-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../3-mysql-server-core-8.0_8.0.26-0ubuntu0.20.04.2_amd64.de
b ...
Unpacking mysql-server-core-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Selecting previously unselected package mysql-server-8.0.
Preparing to unpack .../4-mysql-server-8.0_8.0.26-0ubuntu0.20.04.2_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Unpacking mysql-server-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../5-mysql-server_8.0.26-0ubuntu0.20.04.2_all.deb ...
Unpacking mysql-server (8.0.26-0ubuntu0.20.04.2) ...
Setting up mysql-client-core-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Setting up mysql-client-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Setting up libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...
Setting up mysql-server-core-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Setting up mysql-server-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Configuration file '/etc/mysql/mysql.conf.d/mysqld.cnf'
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** mysqld.cnf (Y/I/N/O/D/Z) [default=N] ?
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned
error exit status 2
No apport report written because the error message indicates its a followup erro
r from a previous failure.
dpkg: dependency problems prevent configuration of mys
ql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.11) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
When I run sudo mysql
, I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
And when I run systemctl status mysql
, I get this output:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; disabled; ve>
Active: inactive (dead)
Any advice would be appreciated.