Having issues starting MySQL Daemon

Conner Stephen McCabe picture Conner Stephen McCabe · Jul 28, 2012 · Viewed 11.5k times · Source

I'm new to the forums here but I hope to become more active as I've recently purchased a dedicated server and I'm running Fedora off of it so it's a constant learning process, I'm fairly average at BASH, but I know enough to make my way around, I'm a software developer to trade more than a network techi. Which leads me to my initial problem, I'm having an issue starting my MySQL daemon after rebooting my dedi, I have no clue why it's suddenly doing this, I'm running PHPMyAdmin from the server and also issuing certain commands through the CLI for MySQL, but after rebooting I'm getting this error everytime I try to start the instance of the daemon:

[root@ks23085 ~]# service mysqld start
Redirecting to /bin/systemctl  start mysqld.service
[root@ks23085 ~]# systemctl mysqld start
Unknown operation mysqld
[root@ks23085 ~]# systemctl start mysqld
Failed to issue method call: Unit name mysqld is not valid.
[root@ks23085 ~]# systemctl start mysqld.service
[root@ks23085 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysql.sock' (2)

It's completely bizarre as it was working perfectly before I rebooted it, I didn't update it or change the install, the only thing that I did do was install postfix, but I don't see why that would cause any issues with MySQL :S

I really need a hand on this one, I've tried several solutions from google with no results whatsoever. Thanks in advance guys.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update 1:

Okay, so I found the directory that mysqld is held, it was '/usr/libexec/mysqld', I typed './mysqld start' in this directory and it specifies this output:

120729  1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
./mysqld: Can't change dir to '/run/mysql/' (Errcode: 2)
120729  1:49:09 [ERROR] Aborting

120729  1:49:09 [Note] ./mysqld: Shutdown complete

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Update 2:

I managed to get passed the directory issue by creating the 'mysql' directory in 'run/' with all my old databases, but now I seem to be getting an error that doesn't seem to be as easy to fix :/

Here's the output:

120729  2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  2:15:59 [Note] Plugin 'FEDERATED' is disabled.
120729  2:15:59 [Note] Plugin 'InnoDB' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
120729  2:15:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120729  2:15:59 [ERROR] mysqld: unknown option '--skip-locking'
120729  2:15:59 [ERROR] Aborting

120729  2:15:59 [Note] mysqld: Shutdown complete

Answer

hovanessyan picture hovanessyan · Jul 28, 2012

The official doc states that there's 2 possible reasons for this error:

  1. You don't have permissions to access the directory /var/lib/mysql/whatever.sock because mysql is the owner of the folder or
  2. /path/whatever.sock doesn't exist.

Execute the following to find your socket:

mysqladmin variables | grep socket

Added to configuration file as suggested:

You can try this though [Linux specific, but what other operating systems are there?] Go to /etc/my.cnf and change/add the lines:

[mysqld]

datadir=/var/lib/mysql

socket=/tmp/mysql.sock

[client]

socket=/tmp/mysql.sock

2) Don't forget to check your permissions!