Job for mysqld.service failed in Centos 7
Check below things to fix the issue
Check the permission of mysql data dir using below command. The ownership should be
mysql:mysql
and the directory permission should be700
ls -ld /var/lib/mysql/
Check the permission of databases inside mysql data dir using below command. The ownership should be mysql:mysql for all the files inside that directory
ls -lh /var/lib/mysql/
Check the listening network tcp ports using below command
netstat -ntlp
Check the mysql log files for any error using below command.
cat /var/log/mysql/mysqld.log
Try to start mysql using below command
mysqld_safe --defaults-file=/etc/my.cf
Unable to start MySQL server - Control process exited with error code
Mysql server stopped unexpectedly on my new on Ubuntu 18.04 instance, and getting same error while trying to start.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
When running the command systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-08-29 17:11:53 UTC; 11s ago
Process: 3124 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 2557 (code=exited, status=0/SUCCESS)
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: Failed to start MySQL Community Server.
After struggling almost 6 hours searching over the internet finally got the solution.
sudo chmod -R u+rwx /etc/mysql/
sudo chown -R mysql.mysql /etc/mysql/
Related Topics
Convert String to Date in Ms Access Query
Find Out Where MySQL Is Installed on MAC Os X
Check If a Row Exists, Otherwise Insert
Sql Query for Values Consisting of Only a Specific Character
Sql Select Last N Rows, Sort Them Reversed
Sql String: Counting Words Inside a String
Combining Multiple Rows in SQL Server into One
How to Change Date Format in .Net Rdlc Report
Convert a 12 Hour Format to 24 Hour Format in SQL Server
Loop Through Table Rows and Call Stored Procedure on Every Row
How to Delete Multiple Rows in Diferent Tables
Sql - Finding Students Taking 2 or More Classes
Mysql Error 1449: the User Specified as a Definer Does Not Exist
Trim Whitespaces (New Line and Tab Space) in a String in Oracle
State Wise Data of Country and City
Get Count of Records in Every Hour in the Last 24 Hour