Following error is being showed while checking the status for my-sql .
OS: Ubuntu 18.04.3
Mysql: mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-08-31 08:27:11 CEST; 1min 12s ago
Process: 18000 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 31 08:27:11 myserver systemd[1]: Failed to start MySQL Community Server.
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Aug 31 08:27:11 myserver systemd[1]: Stopped MySQL Community Server.
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Start request repeated too quickly.
Aug 31 08:27:11 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 31 08:27:11 myserver systemd[1]: Failed to start MySQL Community Server.
I tried to start using mysqld command which ended with following error
mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
2019-08-31T12:51:57.596969Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-08-31T12:51:57.597359Z 0 [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
2019-08-31T12:51:57.597485Z 0 [ERROR] Aborting
2019-08-31T12:51:57.597607Z 0 [Note] Binlog end
my.cnf
#
# 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
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
Best Answer
The errors you got on the console when running
mysqld
directly include:That's your problem.
To resolve it, first check the user that your
mysqld
is attempting to run as; this will be the user "mysql" in a default Debian install (I assume it should be the same for Ubuntu); to verify this, check/etc/mysql/my.cnf
and look for a "user = xxx" line.Once you know what user
mysqld
is trying to run as, check that the directory/var/lib/mysql-files
exists (sudo mkdir /var/lib/mysql-files
if it doesn't) and is owned by the usermysqld
runs as (sudo chown mysql /var/lib/mysql-files
if it isn't; replace "mysql" in thechown
command with the correct user name if you're configured to run as a different user).Then try
sudo mysqld
again and you should either get a successfulmysqld
startup, or (if there are other problems with your setup) a new and different error message.