I cannot start mysql.server in the Ubuntu 20.04

Ubuntu's version:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal

I'm having problems for start to mysql, always that I trying appears the next message:

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

I tried check the mysqld.log using the command tail -f /var/log/mysqld.log, but there doesn't appear to be one.

So I tried to check with systemctl status mysql.service and appears this:

mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2021-06-07 11:56:52 -03; 5h 18min ago Docs: man:mysqld(8) Process: 8885 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=1/FAILURE)
jun 07 11:56:52 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
jun 07 11:56:52 mauriciojr27-Inspiron-3442 systemd[1]: Stopped MySQL Community Server.
jun 07 11:56:52 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Start request repeated too quickly.
jun 07 11:56:52 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Failed with result 'exit-code'.
jun 07 11:56:52 mauriciojr27-Inspiron-3442 systemd[1]: Failed to start MySQL Community Server.

My mysql.cnf file is configured like this:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
#
#
# IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

Further I tried install and after remove the MySQL APT Repository, but this message appears:

Error while installing package: the subprocess installed, package mysql-common, script post-installation return the error status exit 2

Output of the command sudo journalctl -u mysql.service -n 100:

-- Logs begin at Sat 2021-01-09 07:11:57 -03, end at Mon 2021-06-07 17:52:46 -03. --
jun 07 10:37:25 mauriciojr27-Inspiron-3442 systemd[1]: Starting MySQL Community Server...
jun 07 10:37:25 mauriciojr27-Inspiron-3442 mysql-systemd-start[73897]: MySQL configuration not found at /etc/mysql/my.cnf>
jun 07 10:37:25 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILU>
jun 07 10:37:25 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Failed with result 'exit-code'.
jun 07 10:37:25 mauriciojr27-Inspiron-3442 systemd[1]: Failed to start MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 3.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Stopped MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Starting MySQL Community Server...
jun 07 10:37:26 mauriciojr27-Inspiron-3442 mysql-systemd-start[73936]: MySQL configuration not found at /etc/mysql/my.cnf>
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILU>
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Failed with result 'exit-code'.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Failed to start MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Stopped MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Starting MySQL Community Server...
jun 07 10:37:26 mauriciojr27-Inspiron-3442 mysql-systemd-start[73975]: MySQL configuration not found at /etc/mysql/my.cnf>
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILU>
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Failed with result 'exit-code'.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Failed to start MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Stopped MySQL Community Server.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Start request repeated too quickly.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: mysql.service: Failed with result 'exit-code'.
jun 07 10:37:26 mauriciojr27-Inspiron-3442 systemd[1]: Failed to start MySQL Community Server.
-- Reboot --
jun 07 11:56:50 mauriciojr27-Inspiron-3442 systemd[1]: Starting MySQL Community Server...

The command sudo tail -f /var/log/mysql/error.log not return anything

How can I fix this?

6

1 Answer

The error is clearly stated in the output:

jun 07 10:37:25 mauriciojr27-Inspiron-3442 mysql-systemd-start[73897]: MySQL configuration not found at /etc/mysql/my.cnf>

Your system tries to use my.cnf and you provided mysql.cnf. Try to copy mysql.cnf to my.cnf and restart.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like