Log errornya dilihat dari journal -xn
-- Unit mysql.service has begun starting up. Feb 12 16:01:09 kai /etc/init.d/mysql[11135]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf Feb 12 16:01:09 kai /etc/init.d/mysql[11135]: [61B blob data] Feb 12 16:01:09 kai /etc/init.d/mysql[11135]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysq Feb 12 16:01:09 kai /etc/init.d/mysql[11135]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' Feb 12 16:01:09 kai /etc/init.d/mysql[11135]: Feb 12 16:01:09 kai mysql[10388]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . Feb 12 16:01:09 kai systemd[1]: mysql.service: control process exited, code=exited status=1 Feb 12 16:01:09 kai systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon. -- Subject: Unit mysql.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysql.service has failed. -- -- The result is failed. Feb 12 16:01:09 kai systemd[1]: Unit mysql.service entered failed state. Feb 12 16:01:53 kai systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Solusi
1. Check folder dan file di /var/run/mysqld
$ ls -l /var/run/mysqld total 4 -rw-rw---- 1 mysql mysql 6 Feb 12 16:03 mysqld.pid srwxrwxrwx 1 mysql mysql 0 Feb 12 16:03 mysqld.sock
bila file atau folder diatas ngga ada buat baru
mkdir /var/run/mysqld touch /var/run/mysqld/mysql.{pid,sock} chown mysql:mysql -R /var/run/mysqld
2. Cek folder /var/log/mysql
$ ls -l /var/log/mysql/ total 8 -rw-r----- 1 mysql adm 5695 Feb 12 16:03 error.log
bila belum ada buat baru
mkdir /var/log/mysql chown mysql:adm /var/log/mysql
3. Check port 3306
netstat -tunlp | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 12375/mysqld
matikan service tersebut
kill -9 12375
ganti 12375
dengan PID diatas.
setelah langkah-langkah tersebut dijalankan, jalankan service mysql
service mysql start
service mysql sukses dijalankan
Feb 12 16:03:55 kai systemd[1]: Starting LSB: Start and stop the mysql database server daemon... -- Subject: Unit mysql.service has begun with start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysql.service has begun starting up. Feb 12 16:03:57 kai mysql[11975]: Starting MySQL database server: mysqld .. Feb 12 16:03:57 kai mysql[11975]: Checking for tables which need an upgrade, are corrupt or were Feb 12 16:03:57 kai mysql[11975]: not closed cleanly.. Feb 12 16:03:57 kai systemd[1]: Started LSB: Start and stop the mysql database server daemon. -- Subject: Unit mysql.service has finished start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysql.service has finished starting up. -- -- The start-up result is done. Feb 12 16:03:57 kai /etc/mysql/debian-start[12431]: Upgrading MySQL tables if necessary. Feb 12 16:03:57 kai /etc/mysql/debian-start[12434]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored Feb 12 16:03:57 kai /etc/mysql/debian-start[12434]: Looking for 'mysql' as: /usr/bin/mysql Feb 12 16:03:57 kai /etc/mysql/debian-start[12434]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck Feb 12 16:03:57 kai /etc/mysql/debian-start[12434]: This installation of MySQL is already upgraded to 5.5.47, use --force if y Feb 12 16:03:57 kai /etc/mysql/debian-start[12445]: Checking for insecure root accounts. Feb 12 16:03:57 kai /etc/mysql/debian-start[12450]: Triggering myisam-recover for all MyISAM tables