Why is MYSQL not starting?

When running the command 'sudo service mysql start' this is the output.

'[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!'

Here are the steps taken to troubleshoot already:

1. Checked permissions for /var/run/mysqld, it's owned by mysql but the user is root.

2. The syslog file has been checked and gives the following,

'ERROR 2002 (HY000): 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

After checking the my.cnf file the path's for the socket matched.

When running 'which mysql' this is the output '/usr/bin/mysql'

Monit has recently been installed on the server as well as the port was changed to port 99. Everything has been running fine up until now. (About a week and a half after said changes were made.)

Linode has been reboot a couple of times to troubleshoot memory issues but to no avail.

Here is some output from various commands

user@hostname:~$ df -h
 Filesystem      Size  Used Avail Use% Mounted on
 /dev/root        24G  7.3G   16G  32% /
 devtmpfs        494M     0  494M   0% /dev
 tmpfs           100M  208K   99M   1% /run
 tmpfs           5.0M     0  5.0M   0% /run/lock
 tmpfs           250M     0  250M   0% /run/shm
user@hostname:~$ df -i
 Filesystem      Inodes  IUsed   IFree IUse% Mounted on
 /dev/root      1556480 177140 1379340   12% /
 devtmpfs        126432   1379  125053    2% /dev
 tmpfs           126898    780  126118    1% /run
 tmpfs           126898      2  126896    1% /run/lock
 tmpfs           126898      2  126896    1% /run/shm
user@hostname:~$ free -m
                             total       used       free     shared    buffers     cached
                Mem:           991        501        489          0         52        237
                -/+ buffers/cache:        211        779
                Swap:          255          0        255

We have ruled out the possibility of a failed mysql process that is still running with the following commands

 user@hostname:/var/run/mysqld$ ps aux | grep mysql
 user  28834  0.0  0.2   7856  2068 pts/0    S+   13:00   0:00 grep mysql
 user@hostname:/var/run/mysqld$ kill 28834
 -bash: kill: (28834) - No such process
 user@hostname:/var/run/mysqld$ kill 7856
 -bash: kill: (7856) - No such process
 user@hostname:/var/run/mysqld$ kill 2068
 -bash: kill: (2068) - No such process
 user@hostname:/var/run/mysqld$ man kill
 user@hostname:/var/run/mysqld$ kill -l
 1) SIGHUP   2) SIGINT   3) SIGQUIT  4) SIGILL   5) SIGTRAP
 6) SIGABRT  7) SIGBUS   8) SIGFPE   9) SIGKILL 10) SIGUSR1
 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
 16) SIGSTKFLT   17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
 21) SIGTTIN 22) SIGTTOU 23) SIGURG  24) SIGXCPU 25) SIGXFSZ
 26) SIGVTALRM   27) SIGPROF 28) SIGWINCH    29) SIGIO   30) SIGPWR
 31) SIGSYS  34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
 38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
 43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
 58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
 63) SIGRTMAX-1  64) SIGRTMAX

4 Replies

Check your MySQL logs. Depending on what distribution you're running, this might be in /var/log/mysql.log, /var/log/mysql/error.log, or something similarly named. It should contain more detail than what's in the syslog.

Checkout the below steps -

1. You don't have to change the tmp directory in the my.cnf file. Even adding a second directory, changing from tempdir =/tmp to =/tmp:/newdir crashed mysql. In 10.04 using MySQL 5.1 you used to have to add the second path other wise you got an error something like can't write temp file…. Of course did change the datadir to /MyDisk/myNewDir

2. Used the wrong permission flags on my file copy from the command line. Should use cp -R -p /var/lib/mysql /MyDisk/myNewDir. Not sure if that really mattered as trashed old dir and started over with the flags as stated so did not test with old permissions. This did work.

3. Added /MyDisk/myNewDir/ r, and /MyDisk/myNewDir/* rwk, to the bottom of etc/apparmor.d/usr.sbin.mysqld file. Also changed the var/lib/mysql entries in apparmor as above

4. Left in the var/run… file as created above. Also not sure if that matters but already behind in getting the server updated so not really caring past having it working properly.

sudo service mysql stop

sudo /etc/init.d/apparmor reload

sudo service mysql start

Check out logs first if it is a cPanel server you can find logs under /var/lib/mysql/serverhostname.err for other distros check /var/log/mysql

Please stop spamming threads to get your sig noticed.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct