Unable to install mysql server on Ubuntu 12.04 - mysql

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.

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

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

Can't install MySQL on Ubuntu 16.04

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

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

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