Beberapa hari lalu saya mengalami kendala dalam menjalankan service mysql
, saat saya menjalankan sudo service mysql restart
muncul error sbb:
username@hostname:~ $ service mysqld restart
Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
Jika kamu mengalami hal serupa mungkin kamu bisa mencoba langkah yang saya lakukan:
- Check file
my.cnf
pada folder/etc/mysql/my.cnf
Berikut adalah isi file my.cnf
secara default:
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
Jika kamu menemukan baris baru setelah !includedir /etc/mysql/mysql.conf.d/
pastikan kalau kamu tahu itu untuk apa, jika tidak tahu dari mana baris itu ditambahkan, kamu bisa mencoba menghapus atau menjadikan comment dengan menambahkan tanda #
- Lakukan end process untuk `mysql`
Pertama lakukan pengecheckan proses dengan ps -aux | grep mysql
, maka akan muncul seperti dibawah ini
username@hostname:~$ ps -aux | grep mysql
mysql 51944 0.0 39.4 1329800 396788 ? Ssl Feb12 0:51 /usr/sbin/mysqld
username-m+ 63729 0.0 0.0 8160 736 pts/0 S+ 06:20 0:00 grep --color=auto mysql
Pada kasus diatas proses ID nya adalah 51944
. Ketikkan kill <process_id>
, dalam kasus ini kill 51944
.
Lalu coba lagi jalankan sudo service mysql start
- Jika semuanya gagal, cobalah restart server anda.
Jika ketiga cara tersebut masih gagal, maka perlu dicheck ulang lebih detail lagi seperti log pada web server, mysql, server, dll. Mungkin disana ada petunjuk yang akan membantu anda.