I have performed a charset change via my.ini into utf8 and forgot a user loggen in in another terminal session, when I performed a service restart.

Initially systemd reported a problem stopping the service while the service was still working. After a system reboot through systemd was never able to start the service again.

$ sudo service mysql status

● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code)
Process: 2750 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 2747 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 2750 (code=exited, status=1/FAILURE);
: 2751 (mysql-systemd-s)
Tasks: 2 (limit: 512)
CGroup: /system.slice/mysql.service
├─2751 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─2838 sleep 1
systemd[1]: Starting MySQL Community Server...
systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

That is the current status of the service as reported by systemd.

Also when I try starting the service:
$ sudo systemctl start mysql.service
I get a failure analyzed to the following from journalctl:
$ journalctl -xe

-- Unit mysql.service has begun starting up.
pam_unix(sudo:session): session closed for user root user : TTY=pts/0 ; PWD=/var/log/mysql ; USER=root ; COMMAND=/bin/systemctl start mysql.service
pam_unix(sudo:session): session opened for user root by user(uid=0)
mysql.service: Main process exited, code=exited, status=1/FAILURE
pam_unix(cron:session): session opened for user root by (uid=0)
(root) CMD ( [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
pam_unix(cron:session): session closed for user root
Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Which suggests having something to do with the pam authentication module
. But I don't know how to deal with it...


I finally solved the issue by logging in as root using:

sudo mysql -uroot -p
and then exiting
mysql> exit

and the service started working (and restarting normally).

As it seems the service was in a zombie state! Even though reported as not running by systemd it was actually running because I was able to login with root and issue a show databases; command which worked like a charm!

Strange issue indeed! By the way if someone knows why I need to use sudo to login as root in the database while all other users are logged in with a simple call to mysql client and their credentials. I would love to understand why! There seems to be strange relationship between linux users and mysql users which I have never really understood.

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.