Tuesday, January 4, 2022

[SOLVED] Fail to install MySQL in Linux Ubuntu

Issue

I had ever installed MySQL in my Linux Ubuntu 18.04.6 LTS, but it had some problem, then I removed it.
However I wanted to install back again, so I followed this code to uninstall

sudo rm -rf /var/lib/mysql/mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

I want install again by:

sudo apt-get install mysql-server

Then, some error code come up:

update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-client (8.0.27-1ubuntu18.04) ...
Setting up mysql-client (8.0.27-1ubuntu18.04) ...
Setting up mysql-community-server (8.0.27-1ubuntu18.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 8.0.27-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
/usr/bin/mandb: can't write to /var/cache/man/9261: No space left on device
/usr/bin/mandb: can't create index cache /var/cache/man/9261: No space left on device
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I use this:

systemctl status mysql.service

this result show up:

 mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2021-12-29 19:24:39 CST; 16min ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 7425 (code=exited, status=1/FAILURE)
   Status: "Server startup in progress"

12月 29 19:24:39 jacky-VirtualBox systemd[1]: Starting MySQL Community Server...
12月 29 19:24:39 jacky-VirtualBox su[7395]: Successful su for mysql by root
12月 29 19:24:39 jacky-VirtualBox su[7395]: + ??? root:mysql
12月 29 19:24:39 jacky-VirtualBox su[7395]: pam_unix(su:session): session opened for user mysql by (uid=0)
12月 29 19:24:39 jacky-VirtualBox su[7395]: pam_unix(su:session): session closed for user mysql
12月 29 19:24:39 jacky-VirtualBox systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
12月 29 19:24:39 jacky-VirtualBox systemd[1]: mysql.service: Failed with result 'exit-code'.
12月 29 19:24:39 jacky-VirtualBox systemd[1]: Failed to start MySQL Community Server.

I had tried to uninstall MySQL again and again, but it didn't work.
Hope guys can give some suggestion.


Solution

Maybe you must reinstall the whole operating system, because you have wrongly partitioned disk.

Or you just have full disk.



Answered By - jihndoc