web-dev-qa-db-fra.com

Problèmes d'installation de MySQL sur Ubuntu 14.04

Je frappe rapidement l'erreur suivante en entrant le mot de passe mysql "root":

An error occurred while setting the password for the MySQL administrative user. 
This may have happened because the account already has a password, or because of a
communication problem with the MySQL server.

Voici la sortie complète d'apt-get install mysql-server:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-Perl libdbi-Perl libmysqlclient18 libterm-readkey-Perl
  mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server-5.5
  mysql-server-core-5.5
Suggested packages:
  libclone-Perl libmldbm-Perl libnet-daemon-Perl libplrpc-Perl
  libsql-statement-Perl tinyca mailx
The following NEW packages will be installed:
  libaio1 libdbd-mysql-Perl libdbi-Perl libmysqlclient18 libterm-readkey-Perl
  mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server
  mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 11 newly installed, 0 to remove and 49 not upgraded.
Need to get 0 B/8,797 kB of archives.
After this operation, 93.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libaio1:i386.
(Reading database ... 88930 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_i386.deb ...
Unpacking libaio1:i386 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.5.40-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package libmysqlclient18:i386.
Preparing to unpack .../libmysqlclient18_5.5.40-0ubuntu0.14.04.1_i386.deb ...
Unpacking libmysqlclient18:i386 (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package libdbi-Perl.
Preparing to unpack .../libdbi-Perl_1.630-1_i386.deb ...
Unpacking libdbi-Perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-Perl.
Preparing to unpack .../libdbd-mysql-Perl_4.025-1_i386.deb ...
Unpacking libdbd-mysql-Perl (4.025-1) ...
Selecting previously unselected package libterm-readkey-Perl.
Preparing to unpack .../libterm-readkey-Perl_2.31-1_i386.deb ...
Unpacking libterm-readkey-Perl (2.31-1) ...
Selecting previously unselected package mysql-client-core-5.5.
Preparing to unpack .../mysql-client-core-5.5_5.5.40-0ubuntu0.14.04.1_i386.deb ...
Unpacking mysql-client-core-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client-5.5_5.5.40-0ubuntu0.14.04.1_i386.deb ...
Unpacking mysql-client-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.5.
Preparing to unpack .../mysql-server-core-5.5_5.5.40-0ubuntu0.14.04.1_i386.deb ...
Unpacking mysql-server-core-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up mysql-common (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 89293 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.40-0ubuntu0.14.04.1_i386.deb ...
Unpacking mysql-server-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.40-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-server (5.5.40-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libaio1:i386 (0.3.109-4) ...
Setting up libmysqlclient18:i386 (5.5.40-0ubuntu0.14.04.1) ...
Setting up libdbi-Perl (1.630-1) ...
Setting up libdbd-mysql-Perl (4.025-1) ...
Setting up libterm-readkey-Perl (2.31-1) ...
Setting up mysql-client-core-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.5 (5.5.40-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.5 (5.5.40-0ubuntu0.14.04.1) ...
141117 20:53:10 [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 package 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 package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.3) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Pour désinstaller complètement mysql, j'ai parcouru les étapes suivantes:

Sudo apt-get remove --purge mysql-server mysql-client mysql-common
Sudo apt-get remove --purge mysql-server-core-5.5 mysql-client-core-5.5
Sudo apt-get autoremove
Sudo apt-get autoclean
Sudo deluser mysql
Sudo rm -rf /var/lib/mysql
Sudo rm -rf /etc/mysql

Cela semble complètement supprimer tout, mais les tentatives d'installation ultérieures produisent le même problème.

J'ai également défini des autorisations sur/tmp.

Il est à noter que Postgres est installé sur cette machine, mais d'après ce que j'ai compris, cela ne devrait pas poser de problème.

Merci d'avance pour toute aide/suggestions.

2
zugzwang

La clé est probablement cette ligne dans la sortie:

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.
  1. Assurez-vous que MySQL est entièrement supprimé/purgé

    Sudo apt-get remove --purge mysql-server mysql-client mysql-common mysql-server-5.5 mysql-client-5.5 mysql-server-core-5.5 mysql-client-core-5.5
    Sudo apt-get autoremove
    Sudo apt-get autoclean
    Sudo rm -rf /var/lib/mysql /etc/mysql
    Sudo deluser mysql
    
    Sudo apt-get dist-upgrade
    Sudo reboot
    Sudo apt-get install mysql-server-5.5
    Sudo apt-get install mysql-server
    
12
zugzwang

J'avais un problème similaire. J'ai essayé d'utiliser MariaDB 10.0 avec MySQL Workbench, et quelques problèmes se sont posés. Le problème est que je finis par installer et désinstaller les paquets MySQL et MariaDB jusqu'à ce que je casse tout et que je ne puisse plus installer MariaDB ou MySQL. J'ai eu du mal à essayer pour le résoudre et finalement j'ai trouvé une solution, je l'ai faite à partir de questions similaires liées à ce problème et aux problèmes de dpkg et d'apt. C'est la même chose pour MariaDB ou MySQL. Alors ... voici la solution:

J'ai tout de même fait comme toi:

Sudo aptitude purge mysql-server mysql-client mysql-common
Sudo apt-get autoremove
Sudo aptitude autoclean
Sudo deluser mysql
Sudo rm -rf /var/lib/mysql
Sudo rm -rf /etc/mysql

Et à partir de maintenant, je l’ai fait sur la base des réponses aux problèmes de dpkg. Je ne sais pas si c'est le plus sûr mais bon, cela a fonctionné:

cd /var/lib/dpkg/info/
Sudo rm -rf mysql*

Et c’est tout, j’ai réinstallé et cela a fonctionné. J'espère que cela est utile pour quelqu'un.

1
Alejandro

D'après votre question, il semble que vous ayez utilisé la commande

Sudo rm -rf /ver/lib/mysql au lieu de Sudo rm -rf /var/lib/mysql

Assurez-vous que my.cnf a été supprimé de l’emplacement /etc/my.cnf.

Sudo rm /etc/my.cnf

Sudo apt-get remove mysql-server mysql-client mysql-common

Une fois que c'est fait, essayez de réinstaller mysql server.

0
vembutech