1

Hello my mysql install is broken i can't uninstall or reinstall them i'm stuck.

Os: POP Os 20.04 LTS

Mysql: mysql Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))

Problem

I have installed mysql properly and started to using them in local env, but if i wanted to connect me to mysql with this command: mysql -u root -p i have the error: cant connect with 'root'@'localhost', if i use sudo mysql -u root -p everything work. If i will use mysql in laravel for push migration i need to use sudo php artisan migrate instead of php artisan migrate i have follow these link for try to fix my problem stackoverflow.com/a/38722661/4575350 and stackoverflow.com/a/15039113/4575350 nothing work for me i had every time the same error if i will remove mysql installation:

user@pc-master : sudo apt remove mysql-server-8.0

Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants seront ENLEVÉS :
  mysql-server mysql-server-8.0
0 mis à jour, 0 nouvellement installés, 2 à enlever et 0 non mis à jour.
2 partiellement installés ou enlevés.
Après cette opération, 1 565 ko d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] o
(Lecture de la base de données... 241161 fichiers et répertoires déjà installés.)
Suppression de mysql-server (8.0.21-0ubuntu0.20.04.4) ...

Progression : [  0%] [................................................................................................................................................................] 
Progression : [ 25%] [########################################........................................................................................................................] 
Suppression de mysql-server-8.0 (8.0.21-0ubuntu0.20.04.4) ...#########################################................................................................................] 
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: erreur de traitement du paquet mysql-server-8.0 (--remove) :
 installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: trop d'erreurs, arrêt
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Failed to preset unit: File mysql.service: Link has been severed
/usr/bin/deb-systemd-helper: error: systemctl preset failed on mysql.service: No such file or directory
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg : error while cleaning up:
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Des erreurs ont été rencontrées pendant l'exécution :
 mysql-server-8.0
L'exécution a été arrêtée car il y avait trop d'erreurs.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Step that i follow to got this error:

  • install mysql : sudo apt install mysql-server mysql-client
  • install php extension: sudo apt install php-pdo php-mysql

after that i have the bug so i use these command:

  • remove mysql: sudo apt remove mysql-server-8.0 mysql-client
  • purge mysql: sudo apt purge mysql-server-8.0 mysql-client
  • autoremove unused dependencies: sudo apt autoremove, sudo apt clean
  • also i have try with: dpkg -r mysql-client, mysql-server-8.0

Every command that i do, does not work i had the same error:

dpkg : error while cleaning up:
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Des erreurs ont été rencontrées pendant l'exécution :
 mysql-server-8.0
L'exécution a été arrêtée car il y avait trop d'erreurs.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Previously use mysql i have install mariadb-server and mariadb-client same problem for root user, but mariadb has been removed properly

I have delete /etc/mysql folder and /var/lib/mysql i deleted these folder to fix my issue but i think this add me another issue , i have the /usr/bin/mysql

3
  • MariaDB and MySql are not the same thing (as I am guessing that you already know). Those code bases split a LONG time ago. Why would you choose to use MySQL over MariaDB? I have never had anything but nightmares with MySQL installations.. I guess you are seeing one here. Commented Sep 28, 2020 at 16:36
  • hello yes i that i fix the problem with this command: find broken package with: dpkg --configure -a and dpkg -P --force-all 'broken-package
    – Jud3v
    Commented Sep 28, 2020 at 17:55
  • You should post your own answer. It looks like not only will it help the next person, you could use the points :) Commented Sep 28, 2020 at 19:24

1 Answer 1

1

i fix the problem with these command:

find broken package with: dpkg --configure -a

and

dpkg -P --force-all 'broken-package-to uninstall

3
  • See! 8-) some points! Commented Sep 28, 2020 at 22:21
  • Wait two days, then accept your own answer and get even more. Many people make up stupid things to do this.. but this one is legit. Commented Sep 29, 2020 at 15:39
  • Ho really ? ok i will remind me this :)
    – Jud3v
    Commented Sep 29, 2020 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .