重启MySQL遇到以下错误:mysqld.service failed to load: No such file or directory.

问题

在Ubuntu server下重启MySQL server

sudo service mysqld restart

碰到以下error

Failed to restart mysqld.service: Unit mysqld.service not found.

解决方法

原来在这个版本Ubuntu下,MySQL Daemon并不叫mysqld,而是就叫MySQL。所以只要把mysqld换成mysql就行

sudo service mysql restart

重启成功后,可以用ps命令确认mysql跑了起来

ps aux | grep mysql

如果看见mysqld进程就成功了,比如

/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Leave a Comment

Your email address will not be published.