Can't install MySQL on Ubuntu 16.04 - mysql

I installed mariadb-server before installing mysql-server (which I wasn't supposed to do), so I purged mariadb* and removed it from the repos. However, I can't install mysql-server.
After sudo apt-get install mysql-server, I get:
Setting up mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
* Stopping MySQL database server mysqld [ OK ] update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
* Stopping MySQL database server mysqld [ OK ] invoke-rc.d: could not determine current runlevel
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up libhtml-tagset-perl (3.20-2) ...
Setting up liburi-perl (1.71-1) ...
Setting up libhtml-parser-perl (3.72-1) ...
Setting up libcgi-pm-perl (4.26-1) ...
Setting up libfcgi-perl (0.77-1build1) ...
Setting up libcgi-fast-perl (1:2.10-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libhtml-template-perl (2.95-2) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libio-html-perl (1.001-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libhttp-message-perl (6.11-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 configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu9) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
After running sudo apt-get install -f, I get:
Setting up mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
* Stopping MySQL database server mysqld [ OK ] Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
* Stopping MySQL database server mysqld [ OK ] invoke-rc.d: could not determine current runlevel
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--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.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)
How do I get around these errors and install mysql-server?

I got it to work by deleting all the MySQL files, which weren't deleted by apt-get purge mysql*:
sudo rm -rf /var/lib/mysql/mysql

Related

mysql server fails to install on Ubuntu 18.04

I am trying to install mysql-server on Ubuntu 18.04. I added https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb as apt repo but when I try to install server I keep getting the below error:
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
2021-11-03T16:38:17.105736Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-03T16:38:17.107286Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
2021-11-03T16:38:17.107308Z 0 [ERROR] Aborting
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.36-1ubuntu18.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.27-3ubuntu1.4) ...
Processing triggers for systemd (237-3ubuntu10.52) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
mysql-community-server
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What I have already tried following various threads already there:
Tried purging/cleaning/removing all mysql packages multiple times. Cleaned up until dpkg -l does not list any mysql packages.
apt-get dist-upgrade

Unable to upgrade mysql-server-5.7

When performing apt get upgrade, I keep getting below error on upgrading mysql-server-5.7
Below error:
Setting up mysql-server-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Checking if update is needed.
Checking server version.
Error occurred: Query against mysql.user table failed when checking the mysql.session.
mysql_upgrade failed with exit status 5
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates it's a follow-up error from a previous failure.
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
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Tried removing mysql-server and mysql-server-5.7, same error.
Also purging causes the same error
you may try to remove package manually
su -c 'dpkg - P -remove --force-all mysql*'
then you need to rebuild rum database
su -c 'apt-get clean all && rpm --rebuilddb'
su -c 'package-cleanup --problems'
Edit
to backup all your databases
mysqldump -u USER -p --all-databases > /mnt/backups/all_databases.sql

Installation Error Mysql to Debian on BeagleBone

When logging in through mysql -u root -i, I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I've tried sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5, I've auto removed, cleaned, removed all associated files. After all that, I did a sudo apt-get remove --purge mysql* just to be safe. Then I installed it again: sudo apt-get install mysql-server
I get an error during the installation:
Setting up libmysqlclient18:armhf (5.5.43-0+deb7u1) ...
Setting up libdbd-mysql-perl (4.021-1+b1) ...
Setting up mysql-client-5.5 (5.5.43-0+deb7u1) ...
Setting up mysql-server-core-5.5 (5.5.43-0+deb7u1) ...
Setting up mysql-server-5.5 (5.5.43-0+deb7u1) ...
[ ok ] Stopping mysql (via systemctl): mysql.service.
[....] Starting mysql (via systemctl): mysql.serviceJob failed. See system journal and 'systemctl status' for details.
failed!
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
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
I'm not really sure what else I can do.
So I guess the purge and installation worked. On one last whim, I decided to reboot my BeagleBone and try again. It worked.

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.