1

Whenever i try to start a daemon service with the

service name start

I get the following error:

/etc/sysconfig/network: line 3: HOSTNAME: command not found
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

I get the same error message for vsftpd when using the same command.

Using the hostname command i can see my hostname and it is correct.

I am on centOS release 6.6

Not really sure what the problem is, and wondering if anyone could help me.

Thanks in advance.

  • Can you post the content of /etc/sysconfig/network? – daniel kullmann Jul 6 '15 at 10:39
  • 2
    Could be space characters in a line like HOSTNAME = some-server, which should be HOSTNAME=some-server. – daniel kullmann Jul 6 '15 at 10:40
4

In Red Hat-based systems, most services which use networking (including MySQL) load the networking configuration into shell variables by sourcing /etc/sysconfig/network. This configuration file contains shell variable assignments similar to:

NETWORKING="yes"
NETWORKING_IPV6="no"
HOSTNAME="www.example.com"
GATEWAYDEV="eth0"

Your error message indicates that there’s a problem with line 3 of /etc/sysconfig/network. Since the shell thinks HOSTNAME is a command, I suspect that you have a space after the word HOSTNAME, probably something similar to

HOSTNAME = "www.example.com"

When the first word in a shell command is followed by a space, it is parsed by the shell as being the name of a command. This space should be removed.

  • 1
    Thanks, that did the job, It's obvious to me now that i should have just edited the network file by the error message. No idea how it happened though. – Louis K Jul 7 '15 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.