2

Today I tried to update ubuntu from 18.04 LTS to 20.04 LTS. with do-release-uprade

After upgrade completed, I tried to start mysql with service mysql start

The result is

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

And then I tried to check with systemctl status mysql.service

The result is

mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2021-04-09 17:45:14 +07; 1min 52s ago
Process: 13824 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

Apr 09 17:45:14 systemd[1]: Failed to start MySQL Community Server.
Apr 09 17:45:14 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Apr 09 17:45:14 systemd[1]: Stopped MySQL Community Server.
Apr 09 17:45:14 systemd[1]: mysql.service: Start request repeated too quickly.
Apr 09 17:45:14 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 09 17:45:14 systemd[1]: Failed to start MySQL Community Server.

I cannot access to mysql anymore because service cannot start.

I do not want to lost any database. I do not have any backup, too.

Is backup /var/lib/mysql is enough? (Anything else that I should backup?)

I am very confuse. What should I do next?

  1. Downgrade to Ubuntu 18.04 Or
  2. Find the way to reinstall mysql 5.7 for Ubuntu 20.04 Or
  3. Try upgrade mysql to 8. (but I cannot start mysql service this time)

Why ubuntu 20.04 cannot support mysql 5.7.33?

Thanks for any help.

  • 2
    Please, show us **MySQL** logs, not SystemD ones. – Nikita Kipriyanov Apr 09 '21 at 11:23
  • @NikitaKipriyanov log from `/var/log/mysql/error.log` the last line is `2021-04-09T09:24:45.435471Z 0 [Note] /usr/sbin/mysqld: Shutdown complete.` I think this is log before I upgrade to ubuntu 20.04 – Tron Natthakorn Apr 09 '21 at 11:31
  • Have you tried to run mysqld by hand (`/usr/bin/mysqld_safe` or something like that, notice user who runs that must have access to data directory)? If it starts and you're able to connect with the mysql client, you can backup all databases and now you have a backup. – Nikita Kipriyanov Apr 09 '21 at 11:59
  • @NikitaKipriyanov mysqldump did not work because Server did not start but I am trying follow this but it is still not work [https://askubuntu.com/questions/1232558/install-mysql-5-7-on-ubuntu-20-04](https://askubuntu.com/questions/1232558/install-mysql-5-7-on-ubuntu-20-04) – Tron Natthakorn Apr 09 '21 at 12:06
  • Was mysqld started successfully by hand (not by service manager)? – Nikita Kipriyanov Apr 09 '21 at 12:09
  • Show the output of `journalctl -u mysql`; also as previously mentioned, try to manually run mysql via something like `/usr/bin/mysqld_safe` and include any output from it. The best way to backup a database is with mysqldump, not by copying raw data on the disk. You should have taken a backup BEFORE upgrading - please always take a full backup in the future before performing work, in addition to having automated backups. You shouldn't lose any data, provided you cleanly shut down things and then did the upgrade. If you didn't, this could be a very big learning opportunity. – tilleyc Apr 09 '21 at 13:47
  • Which version were you running before? What version is it trying to upgrade to? (Your title is ambiguous.) – Rick James Apr 09 '21 at 19:56

1 Answers1

0

After some research, I make dicision to use mysql 8 that more compatible with ubuntu 20.04.

My step is

  1. Uninstall everything that relate to mysql (except /var/lib/mysql/)

apt-get remove --purge mysql-server mysql-client mysql-common

apt-get autoremove

apt-get autoclean

  1. Install Mysql 8 (Because I downgrade from 8 to 5.7 before that why I need to install again) https://www.fosstechnix.com/install-mysql-8-on-ubuntu/

wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb

dpkg -i mysql-apt-config_0.8.15-1_all.deb

apt-get update

apt-get install mysql-server

After that I choose Use Legecy Authentication Method (Retain Mysql 5.x) And can start mysql normally again. I need to recheck everything form many project that will work well with mysql 8 or not.

I do not have any backup because this is just DB Local Test Server.

Thank you every one for help me.