问题:
启动
systemctl start mysqld.service
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 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2020-04-20 06:37:28 EDT; 11s ago
Process: 17057 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 17042 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
Process: 17005 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 16980 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 17042 (code=exited, status=1/FAILURE)
Status: "Data Dictionary upgrade from MySQL 5.7 in progress"
Error: 2 (No such file or directory)
Apr 20 06:37:26 lsf1p13 systemd[1]: Starting MySQL 8.0 database server...
Apr 20 06:37:27 lsf1p13 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Apr 20 06:37:28 lsf1p13 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Apr 20 06:37:28 lsf1p13 systemd[1]: Failed to start MySQL 8.0 database server.
解决办法:
如果是root 可以省略1,2 两步
1. 检查权限: ls -l /var/lib/ | grep mysql
drwxr-xr-x 5 mysql mysql 270 Apr 20 06:38 mysql
drwxr-x--- 2 mysql mysql 6 Aug 7 2019 mysql-files
drwx------ 2 mysql mysql 6 Aug 7 2019 mysql-keyring
2. 如果没有权限赋权限 ,chmod -R 777 /var/lib/mysql
3. 删除mysql 下的内容,肯能里面的内容有冲突引起的,rm -rf /var/lib/mysql/*
4. 启动mysql, systemctl start mysqld.service
5. 查看状态:
systemctl statys mysqld.service
Unknown operation statys.
[root@lsf1p13 playbook]# systemctl status mysqld.service
mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2020-04-20 06:47:12 EDT; 22s ago
Process: 17278 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 17600 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 17472 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 17447 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 17558 (mysqld)
Status: "Server is operational"
Tasks: 39
Memory: 593.1M
CGroup: /system.slice/mysqld.service
└─17558 /usr/libexec/mysqld --basedir=/usr
Apr 20 06:47:03 lsf1p13 systemd[1]: Starting MySQL 8.0 database server...
Apr 20 06:47:04 lsf1p13 mysql-prepare-db-dir[17472]: Initializing MySQL database
Apr 20 06:47:12 lsf1p13 systemd[1]: Started MySQL 8.0 database server.
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/wqjin81/article/details/105642024