MySQL fails to start

From Kolmisoft Wiki
Revision as of 15:17, 17 September 2018 by Edvardas (talk | contribs) (Created page with '<br><br> =About= MySQL process fails to start. =Solution 1= Check if there any information in logs. =Solution 2= Check if there is left free space on disk. If disk is full, rem…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search



About

MySQL process fails to start.

Solution 1

Check if there any information in logs.

Solution 2

Check if there is left free space on disk. If disk is full, remove unnecessary files and start MySQL service again.

Solution 3

Try to remove ib_logfile0 and ib_logfile1, but make backups first:

cp /var/lib/mysql/ib_logfile0 /home/
cp /var/lib/mysql/ib_logfile1 /home/
rm -rf /var/lib/mysql/ib_logfile0
rm -rf /var/lib/mysql/ib_logfile0

And start MySQL again:

/etc/init.d/mysqld start

If MySQL still fails to start, check if there any information in log.

Solution 4

If you see such error in log:

InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ib_logfile0
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

Then execute:

chown -R mysql:mysql  /var/lib/mysql

And start MySQL again:

/etc/init.d/mysqld start

If MySQL still fails to start, check if there any information in log.

Solution 5

Run this command to check more information when MySQL starts:

sh -x /etc/init.d/mysqld start

Example:

[root@CentOS-69-64-minimal ~]# sh -x /etc/init.d/mysqld start
+ . /etc/rc.d/init.d/functions
++ TEXTDOMAIN=initscripts
++ umask 022
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' -z  ']'
++ COLUMNS=80
++ '[' -z  ']'
+++ /sbin/consoletype
++ CONSOLETYPE=pty
++ '[' -f /etc/sysconfig/i18n -a -z  -a -z  ']'
++ . /etc/profile.d/lang.sh
++ unset LANGSH_SOURCED
++ '[' -z  ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL='echo -en \033[60G'
+++ SETCOLOR_SUCCESS='echo -en \033[0;32m'
+++ SETCOLOR_FAILURE='echo -en \033[0;31m'
+++ SETCOLOR_WARNING='echo -en \033[0;33m'
+++ SETCOLOR_NORMAL='echo -en \033[0;39m'
+++ PROMPT=yes
+++ AUTOSWAP=no
+++ ACTIVE_CONSOLES='/dev/tty[1-6]'
+++ SINGLE=/sbin/sushell
++ '[' pty = serial ']'
++ __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
+++ cat /proc/cmdline
++ strstr 'ro root=/dev/md/2 rd_NO_LUKS rd_NO_DM nomodeset   consoleblank=0 crashkernel=131M@48M SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=de' rc.debug
++ '[' 'ro root=/dev/md/2 rd_NO_LUKS rd_NO_DM nomodeset   consoleblank=0 crashkernel=131M@48M SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=de' = 'ro root=/dev/md/2 rd_NO_LUKS rd_NO_DM nomodeset   consoleblank=0 crashkernel=131M@48M SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=de' ']'
++ return 1
+ . /etc/sysconfig/network
++ NETWORKING=yes
++ HOSTNAME=CentOS-69-64-minimal
+ exec=/usr/bin/mysqld_safe
+ prog=mysqld
+ STARTTIMEOUT=120
+ STOPTIMEOUT=60
+ MYOPTIONS=
+ '[' -e /etc/sysconfig/mysqld ']'
+ . /etc/sysconfig/mysqld
++ STARTTIMEOUT=120
++ STOPTIMEOUT=60
++ MYOPTIONS=
+ lockfile=/var/lock/subsys/mysqld
+ get_mysql_option mysqld datadir /var/lib/mysql
++ /usr/bin/my_print_defaults mysqld
++ sed -n 's/^--datadir=//p'
++ tail -n 1
+ result=/var/lib/mysql
+ '[' -z /var/lib/mysql ']'
+ datadir=/var/lib/mysql
+ get_mysql_option mysqld socket /var/lib/mysql/mysql.sock
++ /usr/bin/my_print_defaults mysqld
++ sed -n 's/^--socket=//p'
++ tail -n 1
+ result=/var/lib/mysql/mysql.sock
+ '[' -z /var/lib/mysql/mysql.sock ']'
+ socketfile=/var/lib/mysql/mysql.sock
+ get_mysql_option mysqld_safe log-error /var/log/mysqld.log
++ /usr/bin/my_print_defaults mysqld_safe
++ sed -n 's/^--log-error=//p'
++ tail -n 1
+ result=/var/log/mysqld.log
+ '[' -z /var/log/mysqld.log ']'
+ errlogfile=/var/log/mysqld.log
+ get_mysql_option mysqld_safe pid-file /var/run/mysqld/mysqld.pid
++ /usr/bin/my_print_defaults mysqld_safe
++ sed -n 's/^--pid-file=//p'
++ tail -n 1
+ result=/var/run/mysqld/mysqld.pid
+ '[' -z /var/run/mysqld/mysqld.pid ']'
+ mypidfile=/var/run/mysqld/mysqld.pid
+ case "$1" in
+ start
+ '[' -x /usr/bin/mysqld_safe ']'
++ /usr/bin/mysqladmin --socket=/var/lib/mysql/mysql.sock --user=UNKNOWN_MYSQL_USER ping
+ RESPONSE='/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ '[' 1 = 0 ']'
+ echo '/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ grep -q 'Access denied for user'
+ touch /var/log/mysqld.log
+ chown mysql:mysql /var/log/mysqld.log
+ chmod 0640 /var/log/mysqld.log
+ '[' -x /sbin/restorecon ']'
+ /sbin/restorecon /var/log/mysqld.log
+ '[' '!' -d /var/lib/mysql/mysql ']'
+ chown mysql:mysql /var/lib/mysql
+ chmod 0755 /var/lib/mysql
+ '['  = sos ']'
+ safe_pid=18744
+ ret=0
+ TIMEOUT=120
+ '[' 120 -gt 0 ']'
+ /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
++ /usr/bin/mysqladmin --socket=/var/lib/mysql/mysql.sock --user=UNKNOWN_MYSQL_USER ping
+ RESPONSE='/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ mret=1
+ '[' 1 -eq 0 ']'
+ '[' 1 -ne 1 -a 1 -ne 11 ']'
+ echo '/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ grep -q 'Access denied for user'
+ /bin/kill -0 18744
+ sleep 1
+ let TIMEOUT=120-1
+ '[' 119 -gt 0 ']'
++ /usr/bin/mysqladmin --socket=/var/lib/mysql/mysql.sock --user=UNKNOWN_MYSQL_USER ping
+ RESPONSE='/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ mret=1
+ '[' 1 -eq 0 ']'
+ '[' 1 -ne 1 -a 1 -ne 11 ']'
+ echo '/usr/bin/mysqladmin: connect to server at '\localhost'\ failed
error: '\Can'\t connect to local MySQL server through socket '\/var/lib/mysql/mysql.sock'\ (2)'\
Check that mysqld is running and that the socket: '\/var/lib/mysql/mysql.sock'\ exists!'
+ grep -q 'Access denied for user'
+ /bin/kill -0 18744
+ echo 'MySQL Daemon failed to start.'
MySQL Daemon failed to start.
+ ret=1
+ break
+ '[' 119 -eq 0 ']'
+ '[' 1 -eq 0 ']'
+ action 'Starting mysqld: ' /bin/false
+ local STRING rc
+ STRING='Starting mysqld: '
+ echo -n 'Starting mysqld:  '
Starting mysqld:  + shift
+ /bin/false
+ failure 'Starting mysqld: '
+ local rc=1
+ '[' color '!=' verbose -a -z  ']'
+ echo_failure
+ '[' color = color ']'
+ echo -en '\033[60G'
                                                           + echo -n '['
[+ '[' color = color ']'
+ echo -en '\033[0;31m'
+ echo -n FAILED
FAILED+ '[' color = color ']'
+ echo -en '\033[0;39m'
+ echo -n ']'
]+ echo -ne '\r'
+ return 1
+ '[' -x /bin/plymouth ']'
+ /bin/plymouth --details
+ return 1
+ rc=1
+ echo
+ return 1
+ return 1
+ exit 1
[root@CentOS-69-64-minimal ~]#