Score:0

I cannot start mysql.server in the Ubuntu 20.04

us flag

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)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    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
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
#  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?

ru flag
Include the output of `sudo journalctl -u mysql.service -n 100` please, as it will provide more useful information than `systemctl -l status` will
in flag
Could you [edit] your question to include the following: (1) the version of Ubuntu you are using (2) the tail end of the MySQL log: `sudo tail -f /var/log/mysql/error.log` (3) did MySQL work for you yesterday?
Mauriciojr27 avatar
us flag
No, Mysql don't works yesterday. Actually don't work not once
in flag
How did you install MySQL Server? This error message is pointing to an easy-to-check issue: `MySQL configuration not found at /etc/mysql/my.cnf`
Mauriciojr27 avatar
us flag
Actually installed LAMP first, then I install phpmyadmin and when I went to do login, appear this error `mysqli_real_connect(): (HY000/2002): No such file or directory`. So I went to check the mysql and it was already installed, but not started. I saw this issue, I try to set up the mysql.cnf, but error continued
Mauriciojr27 avatar
us flag
How should it be configured?? Because the directory is correct, only configuration is incorrect
Score:0
in flag

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.

Mauriciojr27 avatar
us flag
Thanks, this solve the problem!!
Marc Vanhoomissen avatar
in flag
@Mauriciojr27 Ok, glad to see it helped. Could you mark the answer as 'Accepted'? This will allow other users to find it more easily.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.