MySQL Restart Failed in MySQL 8.0.30 - mysql

While Restarting the MySQL server version 8.0.30 it is getting failed and couldn't able to fix the issue till now.
ESCOD
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2022-12-31 08:37:07 GMT; 1h 7min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 631823 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 631795 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 631823 (code=exited, status=1/FAILURE)
Status: "Server shutdown complete"
Dec 31 08:37:06 fcg-db-mysql-oracle-lx-129.142 systemd[1]: Starting MySQL Server...
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.614931Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 631823
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.614964Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/usr/share/mysql-8.0/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.620958Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.621191Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.621215Z 0 [ERROR] [MY-010119] [Server] Aborting
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 mysqld[631823]: 2022-12-31T08:37:07.621569Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Dec 31 08:37:07 fcg-db-mysql-oracle-lx-129.142 systemd[1]: Failed to start MySQL Server.
~
while from suggestions from some blogs i have tried mysqld --initialize --console, but it is also throwing error like below
mysqld: Can't create directory '/var/lib/mysql/' (OS errno 17 - File exists)
2022-12-31T18:12:49.257034Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.30) initializing of server in progress as process 3353
2022-12-31T18:12:49.257062Z 0 [Warning] [MY-010339] [Server] Using pre 5.5 semantics to load error messages from /usr/share/mysql-8.0/. If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2022-12-31T18:12:49.257067Z 0 [ERROR] [MY-010342] [Server] Can't read from messagefile '/usr/share/mysql-8.0/errmsg.sys'
2022-12-31T18:12:49.257809Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-12-31T18:12:49.257841Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-12-31T18:12:49.257943Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
[fcgredim#fcg-db-mysql-oracle-lx-129 ~]$
Can anyone help on this?

1 . Run the below command to see if there are any errors in the file configuration.
mysqld --validate-config
Can't create directory '/var/lib/mysql/' (OS errno 17 - File exists)
2 . The above error indicates that something wrong with /var/lib/mysql/. Check if this path exists, and it has this permission drwx------ mysql mysql. (Also, if SElinx installed, check if it has the right label)

Related

Not able to start MySQL Service (Fedora Linux)

I am learning Web Development and am trying to set up a MySql Database for a Spring Boot Application. I am not able to make the MySql Database.
I downloaded mysql using:
sudo dnf install mysql-community-server
Then I got the following errors:
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
$ mysql --version
mysql Ver 8.0.31 for Linux on x86_64 (MySQL Community Server - GPL)
$ sudo service mysql start
Redirecting to /bin/systemctl start mysql.service
Failed to start mysql.service: Unit mysql.service not found.
$ sudo systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.
$ systemctl status mysqld.service
× mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-11-30 06:22:00 IST; 4s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3783 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Process: 3818 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Main PID: 3818 (code=exited, status=1/FAILURE)
Status: "Server shutdown complete"
Error: 22 (Invalid argument)
CPU: 1.043s
Nov 30 06:21:59 fedora systemd[1]: Starting mysqld.service - MySQL Server...
Nov 30 06:22:00 fedora systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Nov 30 06:22:00 fedora systemd[1]: mysqld.service: Failed with result 'exit-code'.
Nov 30 06:22:00 fedora systemd[1]: Failed to start mysqld.service - MySQL Server.
Nov 30 06:22:00 fedora systemd[1]: mysqld.service: Consumed 1.043s CPU time.
I don't have much experience with mysql so I could not do much to fix the error. This [https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run] did not solve the issue. Reinstalling mysql (several times) and restarting my laptop also didn't help.
$ cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/run/mysqld/mysqld.pid
$ cat /etc/mysql/my.cnf
cat: /etc/mysql/my.cnf: No such file or directory
$ cat /var/lib/mysql/my.cnf
cat: /var/lib/mysql/my.cnf: No such file or directory
EDIT:
$ journalctl -xeu mysqld.service
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mysqld.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 30 06:22:00 fedora systemd[1]: mysqld.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
Nov 30 06:22:00 fedora systemd[1]: Failed to start mysqld.service - MySQL Server.
░░ Subject: A start job for unit mysqld.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has finished with a failure.
░░
░░ The job identifier is 3531 and the job result is failed.
Nov 30 06:22:00 fedora systemd[1]: mysqld.service: Consumed 1.043s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service completed and consumed the indicated resources.
Edit: Logs # /var/log/mysql*.log
2022-11-30T00:44:42.089067Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 1064
2022-11-30T00:44:42.091892Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-11-30T00:44:42.091960Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-11-30T00:44:42.092006Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:44:42.092083Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-11-30T00:44:42.331797Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1069
2022-11-30T00:44:42.339299Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 2d9a3bde-7048-11ed-a7cd-f406413544b8.
2022-11-30T00:44:42.342844Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-11-30T00:44:42.342942Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-11-30T00:44:42.342960Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:44:42.343234Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-11-30T00:49:37.543811Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 3714
2022-11-30T00:49:37.544916Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-11-30T00:49:37.544934Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-11-30T00:49:37.545003Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:49:37.545083Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-11-30T00:49:37.768975Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 3719
2022-11-30T00:49:37.773567Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-11-30T00:49:37.773672Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-11-30T00:49:37.773705Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:49:37.774047Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-11-30T00:52:00.113630Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 3813
2022-11-30T00:52:00.114677Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-11-30T00:52:00.114695Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-11-30T00:52:00.114738Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:52:00.114840Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-11-30T00:52:00.358242Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 3818
2022-11-30T00:52:00.362438Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-11-30T00:52:00.362537Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-11-30T00:52:00.362566Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-30T00:52:00.362844Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
Can someone tell me how to fix this?
So the following should cleanup /var/lib/mysql, and then mysql should be able to reinitialize cleanly upon start. This however WILL delete any existing databases, including users and their permissions:
sudo systemctl stop mysqld
sudo rm -rf /var/lib/mysql/
sudo mkdir -p /var/lib/mysql/
sudo chown -R mysql: /var/lib/mysql/
sudo systemctl start mysqld

MySQL service won't start anymore because of OS error 105

Complete MySQL error Log: https://pastebin.com/20QX1ZSc
Overnight my MySQL install suddenly stopped working...
I am using ubuntu 20.04
systemctl:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-05-13 14:50:18 CEST; 17min ago
Process: 4562 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 4570 ExecStart=/usr/sbin/mysqld (code=exited, status=3)
Main PID: 4570 (code=exited, status=3)
Status: "Server startup in progress"
May 13 14:50:18 vault systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
May 13 14:50:18 vault systemd[1]: Stopped MySQL Community Server.
May 13 14:50:18 vault systemd[1]: mysql.service: Start request repeated too quickly.
May 13 14:50:18 vault systemd[1]: mysql.service: Failed with result 'exit-code'.
May 13 14:50:18 vault systemd[1]: Failed to start MySQL Community Server.
/var/log/mysql:
2021-05-13T12:50:18.017977Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25-0ubuntu0.20.04.1) starting as process 4570
2021-05-13T12:50:18.032753Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-13T12:50:18.194467Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-05-13T12:50:18.428966Z 1 [Warning] [MY-012637] [InnoDB] 16384 bytes should have been read. Only 12288 bytes read. Retrying for the remaining bytes.
2021-05-13T12:50:18.604489Z 1 [Warning] [MY-012638] [InnoDB] Retry attempts for reading partial data failed.
2021-05-13T12:50:18.604910Z 1 [ERROR] [MY-012642] [InnoDB] Tried to read 16384 bytes at offset 16498688, but was only able to read 12288
2021-05-13T12:50:18.605273Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 5 in a file operation.
2021-05-13T12:50:18.605645Z 1 [ERROR] [MY-012596] [InnoDB] Error number 5 means 'Input/output error'
2021-05-13T12:50:18.606374Z 1 [ERROR] [MY-012646] [InnoDB] File mysql.ibd: 'read' returned OS error 105. Cannot continue operation
2021-05-13T12:50:18.606762Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.
looks like a data/ file corruption.try these steps:
remove the syslog entry under --> /etc/mysql/conf.d/mysqld_safe_syslog.cnf
backup & remove both ib_logfile0 & ib_logfile1 files under --> /var/lib/mysql
remove entry innodb_force_recovery = 1 from --> etc/mysql/my.cnf
run command --> sudo service mysql start
reference Forcing InnoDB Recovery

mysql.service: Main process exited, code=exited, status=1/FAILURE

i cannot start my mysql server, it crashed all a sudden and i can not find any useful log to say why.
my disk has still some space left, several Gigabytes.
last logs from journalctl -feu mysql are like this, which doesnt help at all:
May 06 16:04:23 soy systemd[1]: Starting MySQL Community Server...
May 06 16:04:23 soy su[5927]: Successful su for mysql by root
May 06 16:04:23 soy su[5927]: + ??? root:mysql
May 06 16:04:23 soy su[5927]: pam_unix(su:session): session opened for user mysql by (uid=0)
May 06 16:04:23 soy su[5927]: pam_unix(su:session): session closed for user mysql
May 06 16:04:24 soy systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 06 16:04:24 soy systemd[1]: mysql.service: Failed with result 'exit-code'. May 06 16:04:24 soy systemd[1]: Failed to start MySQL Community Server.
mysql version 8
mysql Ver 8.0.20 for Linux on x86_64 (MySQL Community Server - GPL)
Linux soy 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
and here the service info:
service mysql status
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2020-05-06 16:04:24 UTC; 7min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 5961 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE) Process: 5876 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 5961 (code=exited, status=1/FAILURE) Status: "Server startup in progress"
May 06 16:04:23 soy systemd[1]: Starting MySQL Community Server...
May 06 16:04:23 soy su[5927]: Successful su for mysql by root
May 06 16:04:23 soy su[5927]: + ??? root:mysql
May 06 16:04:23 soy su[5927]: pam_unix(su:session): session opened for user mysql by (uid=0)
May 06 16:04:23 soy su[5927]: pam_unix(su:session): session closed for user mysql
May 06 16:04:24 soy systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 06 16:04:24 soy systemd[1]: mysql.service: Failed with result 'exit-code'.
May 06 16:04:24 soy systemd[1]: Failed to start MySQL Community Server.
error log:
020-05-07T07:55:44.761003Z 0 [System] [MY-013169] [Server]
/usr/sbin/mysqld (mysqld 8.0.20) initializing of server in progress as
process 2024 2020-05-07T07:55:44.762802Z 0 [ERROR] [MY-010457]
[Server] --initialize specified but the data directory has files in
it. Aborting. 2020-05-07T07:55:44.762827Z 0 [ERROR] [MY-013236]
[Server] The designated data directory /var/lib/mysql/ is unusable.
You can remove all files that the server added to it.
2020-05-07T07:55:44.762887Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-07T07:55:44.762984Z 0 [System] [MY-010910] [Server]
/usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community
Server - GPL. 2020-05-07T07:55:45.026958Z 0 [System] [MY-010116]
[Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 2032
2020-05-07T07:55:45.041675Z 1 [ERROR] [MY-011011] [Server] Failed to
find valid data directory. 2020-05-07T07:55:45.041828Z 0 [ERROR]
[MY-010020] [Server] Data Dictionary initialization failed.
2020-05-07T07:55:45.041889Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-07T07:55:45.042277Z 0 [System] [MY-010910] [Server]
/usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community
Server - GPL. 2020-05-07T07:55:45.298208Z 0 [System] [MY-010116]
[Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 2040
2020-05-07T07:55:45.305008Z 1 [ERROR] [MY-011011] [Server] Failed to
find valid data directory. 2020-05-07T07:55:45.305180Z 0 [ERROR]
[MY-010020] [Server] Data Dictionary initialization failed.
2020-05-07T07:55:45.305248Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-07T07:55:45.305563Z 0 [System] [MY-010910] [Server]
/usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community
Server - GPL.
it says it cannot create a test file, but i have no idea why.
maybe unattended-upgrades broken rights.
the var/lib/mysql folder is owned by mysql user and group. so no idea why it couldnt make files in here.
thats really tricky.

Mysql serivce can't start it, with the control process exited with error code problem

my os is Redhat8.
currtenly I install Mysql, version is "mysql Ver 8.0.13 for Linux on x86_64 (Source distribution)"
I use command "sudo yum install mysql, mysql-server"
But i get error when i want to start mysql services. I keep finding soluction, but still I don't know how to solved it.
Can anyone help me to look at it?
#--------------------------------------------------------------------------------------------------------
[yliu#rhlab1 ~]$ sudo systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
# --------------------------------------------------------------------------------------------
[yliu#rhlab1 ~]$ sudo systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-02-19 12:12:15 AST; 15s ago
Process: 13080 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 13052 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
Process: 13015 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 12991 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 13052 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
Error: 2 (No such file or directory)
Feb 19 12:12:12 systemd[1]: Starting MySQL 8.0 database server...
Feb 19 12:12:15 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Feb 19 12:12:15 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Feb 19 12:12:15 systemd[1]: Failed to start MySQL 8.0 database server.
# ----------------------------------------------------------------------------------------
[yliu#rhlab1 ~]$ sudo cat /var/log/mysql/mysqld.log | nl | tail -n 10
38 2020-02-19T15:48:25.492390Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.13) Source distribution.
39 2020-02-19T15:48:25.492468Z 0 [ERROR] [MY-010065] [Server] Failed to shutdown components infrastructure.
40 2020-02-19T16:12:13.332724Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.13) starting as process 13052
41 2020-02-19T16:12:13.585641Z 1 [ERROR] [MY-010781] [Server] Found ./mysql/index_stats.frm file in mysql schema. DD will create .ibd file with same name. Please rename table and start upgrade process again.
42 2020-02-19T16:12:13.585666Z 1 [ERROR] [MY-010336] [Server] Found .frm file with same name as one of the Dictionary Tables.
43 2020-02-19T16:12:13.585833Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
44 2020-02-19T16:12:13.585871Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/lib/mysql/ is unusable. You can safely remove it.
45 2020-02-19T16:12:13.585881Z 0 [ERROR] [MY-010119] [Server] Aborting
46 2020-02-19T16:12:15.000469Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.13) Source distribution.
47 2020-02-19T16:12:15.000550Z 0 [ERROR] [MY-010065] [Server] Failed to shutdown components infrastructure.
My /etc/my.cnf.d/mysql-server.cnf information is:
[yliu#rhlab1 ~]$ sudo cat /etc/my.cnf.d/mysql-server.cnf
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid
I solved the problem, hope it will helpful for everyone who meet the same problem.
Base on the log:
41 2020-02-19T16:12:13.585641Z 1 [ERROR] [MY-010781] [Server] Found ./mysql/index_stats.frm file in mysql schema. DD will create .ibd file with same name. Please rename table and start upgrade process again.
42 2020-02-19T16:12:13.585666Z 1 [ERROR] [MY-010336] [Server] Found .frm file with same name as one of the Dictionary Tables.
43 2020-02-19T16:12:13.585833Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
44 2020-02-19T16:12:13.585871Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/lib/mysql/ is unusable. You can safely remove it.
so we can remove all the files under /var/lib/mysql/
and then make sure the mysql file owner and group are mysql.
(Django) [yliu#rhlab1 ops]$ sudo ls -al /var/lib/ | grep mysql
drwxr-xr-x. 7 mysql mysql 4096 Feb 24 10:16 mysql
and then you can start mysqld again
sudo systemctl start mysqld

start mysqld acting strange

After installing mysql-community-server-8.0.17-1.el7.x86_64 on centos 7, I tried to run systemctl start mysqld which gave me this:
//ERROR MESSAGE 1
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
Then I ran systemctl status mysqld.service -l and the result was:
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2019-09-29 22:54:21 IST; 1min 5s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 5025 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 4991 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 5025 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 13 (Permission denied)
Sep 29 22:53:56 localhost.localdomain systemd[1]: Starting MySQL Server...
Sep 29 22:54:19 localhost.localdomain mysqld[5025]: 2019-09-29T17:24:19.458682Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 5025
Sep 29 22:54:19 localhost.localdomain mysqld[5025]: 2019-09-29T17:24:19.575176Z 0 [ERROR] [MY-010187] [Server] Could not open file '/var/log/mysqld.log' for error logging: Permission denied
Sep 29 22:54:19 localhost.localdomain mysqld[5025]: 2019-09-29T17:24:19.625828Z 0 [ERROR] [MY-010119] [Server] Aborting
Sep 29 22:54:19 localhost.localdomain mysqld[5025]: 2019-09-29T17:24:19.626927Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
Sep 29 22:54:21 localhost.localdomain systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Sep 29 22:54:21 localhost.localdomain systemd[1]: Failed to start MySQL Server.
Sep 29 22:54:21 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
Sep 29 22:54:21 localhost.localdomain systemd[1]: mysqld.service failed.
Then I changed to permission of mysql.log to 777 but after again starting mysqld I again received ERROR MESSAGE 1 (check above)
This time the status was:
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2019-09-29 22:56:14 IST; 8s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 5110 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 5077 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 5110 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 2 (No such file or directory)
Sep 29 22:56:04 localhost.localdomain systemd[1]: Starting MySQL Server...
Sep 29 22:56:14 localhost.localdomain systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Sep 29 22:56:14 localhost.localdomain systemd[1]: Failed to start MySQL Server.
Sep 29 22:56:14 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
Sep 29 22:56:14 localhost.localdomain systemd[1]: mysqld.service failed.
Then I checked /var/log/mysqld.log which contained:
2019-09-29T17:35:14.918779Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server in progress as process 5295
2019-09-29T17:35:14.922106Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-09-29T17:35:14.922221Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2019-09-29T17:35:14.922316Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-09-29T17:35:14.922661Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
Then I emptied the directory using rm /var/lib/mysql/* -rf, I emptied the mysqld.log and again tried to start mysqld then again ERROR MESSAGE 1 got printed and the log file contained this:
2019-09-29T17:41:57.989709Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-09-29T17:41:57.990134Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
2019-09-29T17:41:58.418384Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 5657
2019-09-29T17:41:59.007005Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2019-09-29T17:41:59.007190Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-09-29T17:41:59.007326Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-09-29T17:41:59.008559Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
I understand it tons of data, what should I do?