重啟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.