This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Reinstall Mysql database with too manny errosr...

My database not responding if i want to make a new database entry. Trying to reinstall, but i have manny errors. It's possible to solve reinstall mysql ? I'm using ubuntu 20.04 on Raspberry Pi 4 Model B with 8Gb ram.

sudo apt-get --reinstall install mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libevent-core-2.1-7 libevent-pthreads-2.1-7 libmecab2 libprotobuf-lite23
  mecab-ipadic mecab-ipadic-utf8 mecab-utils
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server-10.3
  mariadb-server-core-10.3
Suggested packages:
  mailx mariadb-test tinyca
The following packages will be REMOVED:
  mysql-client-8.0 mysql-client-core-8.0 mysql-server-8.0
  mysql-server-core-8.0
The following NEW packages will be installed:
  mariadb-client mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server
  mariadb-server-10.3 mariadb-server-core-10.3
0 upgraded, 6 newly installed, 4 to remove and 8 not upgraded.
1 not fully installed or removed.
Need to get 0 B/15.8 MB of archives.
After this operation, 81.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 162295 files and directories currently installed.)
Removing mysql-server-8.0 (8.0.23-0ubuntu0.20.10.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)

Answer Answered by Daniel Black in this comment.

MariaDB cannot start on the data directory of MySQL-8.0.

If you need to migrate from MySQL-8.0 take a mysqldump of the data, apt-purge mysql-server-8.0 and `mv /var/lib/mysql /var/lib/mysql-8.0` and then install mariadb.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.