On the centos 7 system, when using the regular command: systemctl restart mysql or service mysqld restart to restart mysql, the following error will be reported:
Failed to start mysqld.service: Unit not found.
According to the error reported, I searched a circle on the Internet, but failed! ! !
solution
1. Execute the following command to view the path of mysql.server
find / -name mysql.server
The execution result is as follows:
The path description is as follows:
#mysql源码解压包
/usr/local/mysql-8.0.31/bld/support-files/mysql.server
#我在一台机器上装了两个mysql,端口号分别为:3306、3307
#端口号为3306的mysql
/usr/local/mysql/support-files/mysql.server
#端口号为3307的mysql
/usr/local/mysql3307/support-files/mysql.server
2. Restart mysql with port number 3306
/usr/local/mysql/support-files/mysql.server restart
3. Start mysql with port number 3306
/usr/local/mysql/support-files/mysql.server start
4. Mysql with port number 3306 stops
/usr/local/mysql/support-files/mysql.server stop