MySQL service failed with result: exit-code; In this tutorial, you will learn how to fix/resolve MySQL service failed with result: exit-code or failed to start mysql.service: unit mysql.service not found linux.
If you are trying to start, stop, restart, and the status of your MySQL, but you are facing the following errors
- failed to start MySQL community server
- Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.
- failed to start mysql.service: unit mysql.service not found.
- failed to start mysql.service unit not found linux
Failed to start SQL Community Server — Job for mysql.service failed because the control process exited with error code
Using the following steps, you can fix/resolve failed to start mysql.service: unit mysql.service not found linux or Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details:
- Step 1 – Login to Your SSH Server
- Step 2 – Reinstall MySQL
- Step 3 – Restart MySQL Server
Step 1 – Login to Your SSH Server
First of all, you need to login into your ssh server with username and password.
Step 2 – Reinstall MySQL
Then execute the following command into your terminal to “purge” every file related to MySQL and reinstall mysql-server:
sudo apt-get purge mysql-server mysql-client mysql-common sudo apt-get install mysql-server
Step 3 – Restart MySQL Server
Finally, execute the following command in your terminal to restart your MySQL server:
sudo systemctl restart mysql
Even after following the above steps, if you are still not able to start, stop and restart your MySQL server then you just use one command to solve the MySQL server related issue. which is given below:
Execute the following command into your terminal:
nano /etc/mysql/mysql.conf.d/mysqld.cnf OR vi /etc/mysql/mysql.conf.d/mysqld.cnf
After that, add the following line to your MySQL.cnf file:
innodb_force_recovery = 2
Finally, execute the following command into your terminal to stop and start your mysql server:
sudo systemctl stop mysql.service ---to shut it down sudo systemctl start mysql.service ---to try and start up and see the reason why it is not starting.
Conclusion
That’s it; In this tutorial, you have learned how to fix/resolve failed to start mysql.service: unit mysql.service not found linux or Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.