{"id":2668,"date":"2015-09-25T00:16:01","date_gmt":"2015-09-25T00:16:01","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=2668"},"modified":"2015-09-25T00:16:01","modified_gmt":"2015-09-25T00:16:01","slug":"failed-to-issue-method-call-unit-mysqld-service-failed-to-load-no-such-file-or-directory","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2015\/09\/25\/failed-to-issue-method-call-unit-mysqld-service-failed-to-load-no-such-file-or-directory\/","title":{"rendered":"Failed to issue method call: Unit mysqld.service failed to load: No such file or directory."},"content":{"rendered":"<p># mysql &#8211;version<br \/>\nmysql  Ver 15.1 Distrib 5.5.37-MariaDB, for Linux (x86_64) using readline 5.1<\/p>\n<p>I ran the mysql command on the system &#8211; I received the error message shown below:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# mysql\nERROR 2002 (HY000): Can&#039;t connect to local MySQL server through socket &#039;\/var\/lib\/mysql\/mysql.sock&#039; (111)\n\n<\/pre>\n<p>I checked to see if the mysqld service was running and found it was not.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# systemctl status mysqld.service\nmysqld.service\n   Loaded: not-found (Reason: No such file or directory)\n   Active: inactive (dead)\n\n<\/pre>\n<p>When I tried to start the service, it wouldn&#8217;t start.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# service mysqld start\nRedirecting to \/bin\/systemctl start  mysqld.service\nFailed to issue method call: Unit mysqld.service failed to load: No such file or directory.\n# systemctl start mysqld.service\nFailed to issue method call: Unit mysqld.service failed to load: No such file or directory.\n\n<\/pre>\n<p>I checked the contents of the \/etc\/my.cnf file and saw the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n&#x5B;mysqld]\ndatadir=\/var\/lib\/mysql\nsocket=\/var\/lib\/mysql\/mysql.sock\n# Disabling symbolic-links is recommended to prevent assorted security risks\nsymbolic-links=0\n# Settings user and group are ignored when systemd is used.\n# If you need to run mysqld under a different user or group,\n# customize your systemd unit file for mariadb according to the\n# instructions in http:\/\/fedoraproject.org\/wiki\/Systemd\n\n&#x5B;mysqld_safe]\nlog-error=\/var\/log\/mariadb\/mariadb.log\npid-file=\/var\/run\/mariadb\/mariadb.pid\n\n#\n# include all files from the config directory\n#\n!includedir \/etc\/my.cnf.d\n\n<\/pre>\n<p>I checked for the existence of files and directories<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# ls -ld \/var\/lib\/mysql\ndrwxr-xr-x. 19 mysql mysql 4096 Oct 14 23:46 \/var\/lib\/mysql\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n&#x5B;root@localhost install]# ls -l \/var\/lib\/mysql\/mysql.sock\nsrwxrwxrwx. 1 mysql mysql 0 Sep 29 15:05 \/var\/lib\/mysql\/mysql.sock\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# ls -l \/var\/log\/mariadb\/mariadb.log\n-rw-r-----. 1 mysql mysql 0 Oct  5 20:49 \/var\/log\/mariadb\/mariadb.log\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# ls -l \/var\/run\/mariadb\/mariadb.pid\nls: cannot access \/var\/run\/mariadb\/mariadb.pid: No such file or directory\n\n<\/pre>\n<p>I didn&#8217;t see any mariadb.pid file<\/p>\n<p>When I checked the files in the includedir directory, I saw the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# ls -l \/etc\/my.cnf.d\ntotal 12\n-rw-r--r--. 1 root root 295 Apr 15  2014 client.cnf\n-rw-r--r--. 1 root root 232 Apr 15  2014 mysql-clients.cnf\n-rw-r--r--. 1 root root 744 Apr 15  2014 server.cnf\n\n<\/pre>\n<p>So..how to start the service<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# systemctl start mariadb.service\n# systemctl status mysqld service\nmysqld.service\n   Loaded: not-found (Reason: No such file or directory)\n   Active: inactive (dead)\nservice.service\n   Loaded: not-found (Reason: No such file or directory)\n   Active: inactive (dead)\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# mysql\nERROR 1045 (28000): Access denied for user &#039;root&#039;@&#039;localhost&#039; (using password: NO)\n\n<\/pre>\n<p>When I was using CentOS 6, I had MySQL rather than MariaDB &#8211; didn&#8217;t know I needed to start the MariaDB RDBMS service on the CentOS 7 system using a command referencing mariadb rather mysqld. I assumed I could reference mysqld to start the service.<\/p>\n<p>To have the MariaDB service start automatically each time the system boots, issue the command <\/p>\n<p>&#8220;systemctl enable mariadb.service&#8221;. After you have started the service, also issue the command <\/p>\n<p>&#8220;mysql_secure_installation&#8221;.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# mysql_secure_installation\n\/usr\/bin\/mysql_secure_installation: line 379: find_mysql_client: command not found\n\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\n\nIn order to log into MariaDB to secure it, we&#039;ll need the current\npassword for the root user.  If you&#039;ve just installed MariaDB, and\nyou haven&#039;t set the root password yet, the password will be blank,\nso you should just press enter here.\n\nEnter current password for root (enter for none):\nERROR 1045 (28000): Access denied for user &#039;root&#039;@&#039;localhost&#039; (using password: NO)\nEnter current password for root (enter for none):\nOK, successfully used password, moving on...\n\nSetting the root password ensures that nobody can log into the MariaDB\nroot user without the proper authorisation.\n\nYou already have a root password set, so you can safely answer &#039;n&#039;.\n\nChange the root password? &#x5B;Y\/n] n\n ... skipping.\n\nBy default, a MariaDB installation has an anonymous user, allowing anyone\nto log into MariaDB without having to have a user account created for\nthem.  This is intended only for testing, and to make the installation\ngo a bit smoother.  You should remove them before moving into a\nproduction environment.\n\nRemove anonymous users? &#x5B;Y\/n] y\n ... Success!\n\nNormally, root should only be allowed to connect from &#039;localhost&#039;.  This\nensures that someone cannot guess at the root password from the network.\n\nDisallow root login remotely? &#x5B;Y\/n] Y\n ... Success!\n\nBy default, MariaDB comes with a database named &#039;test&#039; that anyone can\naccess.  This is also intended only for testing, and should be removed\nbefore moving into a production environment.\n\nRemove test database and access to it? &#x5B;Y\/n] Y\n - Dropping test database...\n ... Success!\n - Removing privileges on test database...\n ... Success!\n\nReloading the privilege tables will ensure that all changes made so far\nwill take effect immediately.\n\nReload privilege tables now? &#x5B;Y\/n] Y\nERROR 1146 (42S02) at line 1: Table &#039;mysql.servers&#039; doesn&#039;t exist\n ... Failed!\n\nCleaning up...\n\nAll done!  If you&#039;ve completed all of the above steps, your MariaDB\ninstallation should now be secure.\n\nThanks for using MariaDB!\n\n<\/pre>\n<p>Note on copying files to the maria DB!<\/p>\n<p>If you copy DB files to \/var\/lib\/mysql directory from the hard drive of the prior CentOS 6 system to the new CentOS 7 system to have all of the databases from the old system available on the new system, so that appeared to be the reason that the mysql_secure_installation, which can be found in \/usr\/bin, did not accept my just hitting Enter for the password initially. When I entered the root password for MySQL on the old system, it was accepted. And I was able finally get a prompt where I could enter SQL commands using that password with mysql -u root -p .<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# mysql -u root -p\nEnter password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 11\nServer version: 5.5.37-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.\n\nType &#039;help;&#039; or &#039;\\h&#039; for help. Type &#039;\\c&#039; to clear the current input statement.\n\nMariaDB &#x5B;(none)]&gt;\n\n<\/pre>\n<p>So the 3 steps to enable and run MariaDB are as follows, assuming it was previously installed during the initial setup for the system or with yum install mariadb mariadb-server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# systemctl start mariadb.service\n# systemctl enable mariadb.service\n# mysql_secure_installation \n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p># mysql &#8211;version mysql Ver 15.1 Distrib 5.5.37-MariaDB, for Linux (x86_64) using readline 5.1 I ran the mysql command on the system &#8211; I received the error message shown below: # mysql ERROR 2002 (HY000): Can&#039;t connect to local MySQL server through socket &#039;\/var\/lib\/mysql\/mysql.sock&#039; (111) I checked to see if the mysqld service was running &#8230; <a title=\"Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2015\/09\/25\/failed-to-issue-method-call-unit-mysqld-service-failed-to-load-no-such-file-or-directory\/\" aria-label=\"Read more about Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"class_list":["post-2668","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=2668"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2668\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=2668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=2668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=2668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}