I am on Focal Fossa and i have mysql installed . I was trying to remove it and install mariadb . I tried sudo apt-get remove mysql but when i do mysql -V i am getting mysql Ver 8.0.20-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)). Then i tried sudo apt-get purge mysql* and it gives no matches found
I tried the following and getting the same error
sudo apt-get remove mysql-server
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 191: /usr/share/mysql-common /configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
when i try sudo dpkg -l | grep mysql
The result is
pi mysql-client-8.0 8.0.20-0ubuntu0.20.04.1 amd64 MySQL database client binaries
ii mysql-client-core-8.0 8.0.20-0ubuntu0.20.04.1 amd64 MySQL database core client binaries
ii mysql-common 5.8+1.0.5ubuntu2 all MySQL database common files, e.g. /etc/mysql/my.cnf
pF mysql-server-8.0 8.0.20-0ubuntu0.20.04.1 amd64 MySQL database server binaries and system database setup
pi mysql-server-core-8.0 8.0.20-0ubuntu0.20.04.1 amd64 MySQL database server binaries
ii php7.3-mysql 7.3.18-1+ubuntu20.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.4-mysql
I tried to sudo apt-remove mysql* each of these and was getting
Removing mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-8.0 (--remove):
installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
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
Errors were encountered while processing:
mysql-server-8.0
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
When i tried sudo apt-get -f install i got the error
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
If somebody can help would be grateful .
`
/usr/share/mysql-common/configure-symlinks install mysql "$mysql_cfgdir/mysql.cnf"Renaming removed key_buffer and myisam-recover options (if present) sed: can't read /etc/mysql/mysql.conf.d/mysqld.cnf: No such file or directoryFailed to stop mysql.service: Unit mysql.service not loaded. invoke-rc.d: initscript mysql, action "stop" failed. dpkg: error processing package mysql-server-8.0 (--purge): installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1