首页 > 代码库 > Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.

Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.

可能的原因:

1、http://blog.sina.com.cn/s/blog_4692ea0a0101jqhz.html

2、http://diag.5ustore.com/proxy/index.php?url=1J1h12y31F1b1918yLyByU1FyNyjyD101z1612yo1C1cyc1sy3yc1yyN161611yY0RyiyiyJyY1hymylyj1hyL1gyS1LyWyR1Myhyk0VyMylyvyg0j1j1D1F1k18171r1P1HyuyI1DyNyB1zynyK1yyZyT1y1j1Fyd0Kyj1tyN1xya

 

自己遇到的问题,时 stackoverflow

mysqld.service is a "virtual" unit – it doesn‘t exist on the filesystem, it‘s just part of systemd‘s compatibility layer. You can start it and systemd will run the legacy /etc/rc.d/mysqld initscript, but you cannot systemctl enable it because you need a real .service file which could be symlinked into the proper place.

You can write such a unit yourself and put it in /etc/systemd/system/mysqld.service:

[Unit]Description=MySQL ServerAfter=network.target[Service]ExecStart=/usr/bin/mysqld --defaults-file=/etc/mysql/my.cnf --datadir=/var/lib/mysql --socket=/var/run/mysqld/mysqld.sockUser=mysqlGroup=mysqlWorkingDirectory=/usr[Install]WantedBy=multi-user.target

Run systemctl daemon-reload after creating/modifying.