Mysql

我無法啟動 mysqld.service -> 狀態:在 centos 7 中從 MySQL 5.7 升級數據字典正在進行中

  • June 30, 2020

我已經在 centos 7 上安裝了 mysql 8

當我想啟動 mysqld 服務時,它說:

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

當我執行 systemctl status mysqld.service 它說:

mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor 
preset: disabled)
Active: failed (Result: exit-code) since Mon 2020-01-13 06:01:53 EST; 6min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 5532 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 5504 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 5532 (code=exited, status=1/FAILURE)
Status: "Data Dictionary upgrade from MySQL 5.7 in progress"

Jan 13 06:01:48 server1.lifeandme.net systemd[1]: Starting MySQL Server...
Jan 13 06:01:53 server1.lifeandme.net systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jan 13 06:01:53 server1.lifeandme.net systemd[1]: Failed to start MySQL Server.
Jan 13 06:01:53 server1.lifeandme.net systemd[1]: Unit mysqld.service entered failed state.
Jan 13 06:01:53 server1.lifeandme.net systemd[1]: mysqld.service failed.

我也嘗試重啟服務並清理 /var/lib/mysql 下的日誌文件,但沒有成功

我執行了以下命令在伺服器上安裝燈(與燈安裝相關的歷史)

yum install httpd

systemctl start httpd.service

systemctl enable httpd.service

yum install mariadb-server mariadb

systemctl start mariadb

mysql_secure_installation

systemctl enable mariadb.service

yum install php php-mysql

systemctl restart httpd.service

yum remove php php-server

yum clean packages

yum install epel-release

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum install yum-utils

yum-config-manager --enable remi-php72

yum install php72

yum remove mariadb mariadb-server

systemctl restart httpd.service

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

yum install mysql-community-server

systemctl enable mysqld

systemctl start mysqld =>  ran to error

這對我有用:

/var/lib/mysql假設您有備份或者您不再需要該數據,請清除 mysql 數據目錄。

然後sudo service mysqld start

引用自:https://dba.stackexchange.com/questions/257260