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 usesudo mysql -u root -p
everything work. If i will use mysql in laravel for push migration i need to usesudo php artisan migrate
instead ofphp 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
find broken package with: dpkg --configure -a
anddpkg -P --force-all 'broken-package