Can't install mysql-server package - mysql

I am trying to install the mysql-server package on debian and I am getting an error:
t#mintserver:~$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/2.942 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 372098 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.29-0ubuntu0.18.04.1_all.deb ...
Unpacking mysql-server (5.7.29-0ubuntu0.18.04.1) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not installed.
I read many other replies that told me to purge the packages, correct dependencies, but nothing works.
t#mintserver:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2.933 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not installed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Please, run sudo dpkg --audit or sudo dpkg -C, it's the same. It probably will suggest to you what to do.
Edit: According to your comment,
Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ... update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist dpkg: error processing package mysql-server-5.7 (--configure): installed mysql-server-5.7 package post-installation script subprocess returned error exit status 2 Errors were encountered while processing: mysql-server-5.7
the update-alternatives program failed to find this mysql.cnf file.
Could you try creating that file?
Please, do:
sudo nano /etc/mysql/mysql.cnf
filling with this content:
[mysql]
Then, try again dpkg --configure <package>
Or, this will probably do the job:
sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client
If interested, you could also read A Quick Guide to Using the MySQL APT Repository. They provide different installation approaches for different scenarios.

Related

unable to uninstall mysql broken mysql / install new mysql

I have made some shitty things to MySQL and I facing this.
I am trying to re-install MySQL. directly deleted the MySQL folder using sudo rights and tried to re-install.
the fix will be greatly appreciated
command I am running
sudo apt-get install mysql-server
following is the output I am receiving
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.26-0ubuntu0.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 37 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.26-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.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
https://askubuntu.com/a/1134184/653440
do: sudo apt edit-sources and look for anything containing mariadb like: deb [arch=amd64,arm64,ppc64el] http://ftp.nluug.nl/db/mariadb/repo/10.3/ubuntu bionic main
comment it out by putting a # in front of it. then run
sudo apt update
sudo apt purge mysql-common
sudo apt install mysql-common
after that you can installed mysql-server properly via sudo apt install mysql-server
Helped me fix the issue.

Can not install mysql ubuntu after removing maria db

I was working on mysql database, and unfortunately I installed mariadb and when I want to go back to mysql I have error , I removed mariadb and trying to install mysql with this command
sudo apt-get install mysql-server
but I have this error
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.22-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 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.22-0ubuntu0.16.04.1) ...
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)
and I can not re install mysql , what can I do , I looked for solution but don't have result
Try doing a purge, then re-install.
sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client

Cannot update nor remove maridb

I made a mistake. I had to update mariadb.
So did:
sudo apt-get install mariadb-server
Reading package lists... Done Building dependency tree Reading
state information... Done You might want to run 'apt-get -f install'
to correct these: The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.0 (=
10.0.33+maria-1~trusty) but 10.0.31-0ubuntu0.16.04.2 is to be installed mariadb-server : Depends: mariadb-server-10.2 (>=
10.2.7+maria~xenial) but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a
solution).
And then tried to remove as I got errors:
Reading package
lists... Done Building dependency tree Reading state
information... Done You might want to run 'apt-get -f install' to
correct these: The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.0 (=
10.0.33+maria-1~trusty) but 10.0.31-0ubuntu0.16.04.2 is to be installed E: Unmet dependencies. Try 'apt-get -f install' with no
packages (or specify a solution).
sudo apt-get -f install gives me:
Reading package lists... Done Building dependency tree Reading
state information... Done Correcting dependencies... Done The
following additional packages will be installed: mariadb-client-10.0
mariadb-client-core-10.0 mariadb-server-10.0 mariadb-server-core-10.0
Suggested packages: mailx mariadb-test tinyca Recommended packages:
libhtml-template-perl The following packages will be upgraded:
mariadb-client-10.0 mariadb-client-core-10.0 mariadb-server-10.0
mariadb-server-core-10.0 4 upgraded, 0 newly installed, 0 to remove
and 26 not upgraded. 4 not fully installed or removed. Need to get 0
B/11,7 MB of archives. After this operation, 9709 kB disk space will
be freed. Do you want to continue? [Y/n] y Preconfiguring packages ...
(Reading database ... 304724 files and directories currently
installed.) Preparing to unpack
.../mariadb-server-10.0_10.0.33+maria-1~trusty_amd64.deb ... Unpacking
mariadb-server-10.0 (10.0.33+maria-1~trusty) over
(10.0.31-0ubuntu0.16.04.2) ... dpkg: error processing archive
/var/cache/apt/archives/mariadb-server-10.0_10.0.33+maria-1~trusty_amd64.deb
(--unpack): trying to overwrite
'/usr/share/man/man1/mysql_upgrade.1.gz', which is also in package
mariadb-server-core-10.0 10.0.31-0ubuntu0.16.04.2 dpkg-deb: error:
subprocess paste was killed by signal (Broken pipe) dpkg: regarding
.../mariadb-server-core-10.0_10.0.33+maria-1~trusty_amd64.deb
containing mariadb-server-core-10.0: mariadb-server-10.0 conflicts
with mysql-server-core-5.5 mariadb-server-core-10.0 provides
mysql-server-core-5.5 and is to be installed.
dpkg: error processing archive
/var/cache/apt/archives/mariadb-server-core-10.0_10.0.33+maria-1~trusty_amd64.deb
(--unpack): conflicting packages - not installing
mariadb-server-core-10.0 dpkg: regarding
.../mariadb-client-core-10.0_10.0.33+maria-1~trusty_amd64.deb
containing mariadb-client-core-10.0: mariadb-client-10.0 conflicts
with mysql-client-core-5.5 mariadb-client-core-10.0 provides
mysql-client-core-5.5 and is to be installed.
dpkg: error processing archive
/var/cache/apt/archives/mariadb-client-core-10.0_10.0.33+maria-1~trusty_amd64.deb
(--unpack): conflicting packages - not installing
mariadb-client-core-10.0 dpkg: regarding
.../mariadb-client-10.0_10.0.33+maria-1~trusty_amd64.deb containing
mariadb-client-10.0: mariadb-client-core-10.0 conflicts with
mysql-client-5.5 mariadb-client-10.0 provides mysql-client-5.5 and
is to be installed.
dpkg: error processing archive
/var/cache/apt/archives/mariadb-client-10.0_10.0.33+maria-1~trusty_amd64.deb
(--unpack): conflicting packages - not installing mariadb-client-10.0
Processing triggers for man-db (2.7.5-1) ... Errors were encountered
while processing:
/var/cache/apt/archives/mariadb-server-10.0_10.0.33+maria-1~trusty_amd64.deb
/var/cache/apt/archives/mariadb-server-core-10.0_10.0.33+maria-1~trusty_amd64.deb
/var/cache/apt/archives/mariadb-client-core-10.0_10.0.33+maria-1~trusty_amd64.deb
/var/cache/apt/archives/mariadb-client-10.0_10.0.33+maria-1~trusty_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I'm stuck, cannot install, cannot remove, cannot update.
What should I do?

Unable to install libjpeg-turbo8-dev on Ubuntu

I tried to install libjpeg-turbo8-dev like this.
feng#HP:~$ sudo apt-get install libjpeg-turbo8-dev
[sudo] password for feng:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
kde-l10n-engb libasn1-8-heimdal:i386 libasound2:i386 libasyncns0:i386
libaudio2:i386 libavahi-client3:i386 libavahi-common-data:i386
{***many packages***}
libxml2:i386 libxmu6:i386 libxrender1:i386 libxt6:i386
libxxf86vm1:i386 mysql-common openjdk-7-jre-lib
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
libjpeg-turbo8-dev
0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.
1 not fully installed or removed.
Need to get 0 B/420 kB of archives.
After this operation, 1 219 kB of additional disk space will be used.
(Reading database ... 261347 files and directories currently installed.)
Unpacking libjpeg-turbo8-dev:amd64 (from .../libjpeg-turbo8-dev_1.3.0-0ubuntu1.1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libjpeg-turbo8-dev_1.3.0-0ubuntu1.1_amd64.deb (--unpack):
trying to overwrite '/usr/include/jmorecfg.h', which is also in package libjpeg-turbo-devel 1.3.0-3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libjpeg-turbo8-dev_1.3.0-0ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
My Ubuntu is 13.10
I want to install libjpeg-turbo8-dev, because I want to install mysql-server and mysql-client. Thet depends on this package.
feng#HP:~$ sudo apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libjpeg8-dev : Depends: libjpeg-turbo8-dev (>= 1.1.90+svn722-1ubuntu6) but it is not going to be installed
mysql-client : Depends: mysql-client-5.5 but it is not going to be installed
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
What you could try is to install the synaptic package manager:
sudo apt-get install synaptic
Here is someone who had a similar problem with the java runtime. Maybe this can help you if synaptic doesn't.
Otherwise I am not sure if you do really need the dev package...

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